gpt-4.1-mini-2025-04-14· OpenAI
WildChat-4.8M (AI2)
пришли скрипт роблокс для полёта
- User
пришли скрипт роблокс для полёта
- Assistant
пришли скрипт роблокс для полёта
Конечно! Вот простой пример скрипта для полёта в Roblox с использованием LocalScript. Этот скрипт позволяет игроку летать, удерживая клавишу "F".
-- Скрипт для полёта в Roblox (LocalScript)
-- Нажмите 'F' для включения/отключения полёта
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local userInputService = game:GetService("UserInputService")
local runService = game:GetService("RunService")
local flying = false
local flySpeed = 50
local bodyVelocity
local function toggleFly()
flying = not flying
if flying then
bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.Velocity = Vector3.new(0,0,0)
bodyVelocity.MaxForce = Vector3.new(0,0,0)
bodyVelocity.Parent = humanoidRootPart
else
if bodyVelocity then
bodyVelocity:Destroy()
bodyVelocity = nil
end
end
end
userInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.F then
toggleFly()
end
end)
runService.RenderStepped:Connect(function()
if flying and bodyVelocity then
local moveDirection = Vector3.new()
if userInputService:IsKeyDown(Enum.KeyCode.W) then
moveDirection = moveDirection + (workspace.CurrentCamera.CFrame.LookVector)
end
if userInputService:IsKeyDown(Enum.KeyCode.S) then
moveDirection = moveDirection - (workspace.CurrentCamera.CFrame.LookVector)
end
if userInputService:IsKeyDown(Enum.KeyCode.A) then
moveDirection = moveDirection - (workspace.CurrentCamera.CFrame.RightVector)
end
if userInputService:IsKeyDown(Enum.KeyCode.D) then
moveDirection = moveDirection + (workspace.CurrentCamera.CFrame.RightVector)
end
if userInputService:IsKeyDown(Enum.KeyCode.Space) then
moveDirection = moveDirection + Vector3.new(0,1,0)
end
if userInputService:IsKeyDown(Enum.KeyCode.LeftShift) then
moveDirection = moveDirection - Vector3.new(0,1,0)
end
if moveDirection.Magnitude > 0 then
moveDirection = moveDirection.Unit * flySpeed
bodyVelocity.Velocity = moveDirection
bodyVelocity.MaxForce = Vector3.new(1e5, 1e5, 1e5)
else
bodyVelocity.Velocity = Vector3.new(0,0,0)
bodyVelocity.MaxForce = Vector3.new(0,0,0)
end
end
end)
LocalScript в StarterPlayerScripts или внутри StarterCharacterScripts.Если нужно — могу помочь с доработкой!
Not yet included in a published release.