gpt-4.1-mini-2025-04-14· OpenAI
WildChat-4.8M (AI2)
сделай скрипт на полёт в роблокс для меня что бы я летал
- User
сделай скрипт на полёт в роблокс для меня что бы я летал
- Assistant
сделай скрипт на полёт в роблокс для меня что бы я летал
Создание скрипта для полёта в Roblox требует знания Lua и понимания, как работают объекты в Roblox Studio. Ниже я приведу простой пример скрипта, который позволяет персонажу игрока "летать" при нажатии определённых клавиш.
Важно: Используйте скрипты честно и только в тех играх, где это разрешено (например, в ваших собственных играх). Использование читов в чужих играх запрещено и может привести к блокировке.
Этот скрипт можно вставить в StarterPlayerScripts, чтобы игрок мог управлять полётом через клавиши W, A, S, D и пробел для подъёма.
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local rootPart = character:WaitForChild("HumanoidRootPart")
local flying = false
local flySpeed = 50
local velocity = Vector3.new(0,0,0)
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.MaxForce = Vector3.new(0,0,0)
bodyVelocity.Velocity = Vector3.new(0,0,0)
bodyVelocity.Parent = rootPart
local function startFly()
flying = true
bodyVelocity.MaxForce = Vector3.new(400000, 400000, 400000)
end
local function stopFly()
flying = false
bodyVelocity.MaxForce = Vector3.new(0,0,0)
end
local moveDirection = Vector3.new(0,0,0)
local verticalVelocity = 0
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.F then
if flying then
stopFly()
else
startFly()
end
end
end)
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.W then
moveDirection = moveDirection + Vector3.new(0, 0, -1)
elseif input.KeyCode == Enum.KeyCode.S then
moveDirection = moveDirection + Vector3.new(0, 0, 1)
elseif input.KeyCode == Enum.KeyCode.A then
moveDirection = moveDirection + Vector3.new(-1, 0, 0)
elseif input.KeyCode == Enum.KeyCode.D then
moveDirection = moveDirection + Vector3.new(1, 0, 0)
elseif input.KeyCode == Enum.KeyCode.Space then
verticalVelocity = flySpeed
elseif input.KeyCode == Enum.KeyCode.LeftShift then
verticalVelocity = -flySpeed
end
end)
UserInputService.InputEnded:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.W then
moveDirection = moveDirection - Vector3.new(0, 0, -1)
elseif input.KeyCode == Enum.KeyCode.S then
moveDirection = moveDirection - Vector3.new(0, 0, 1)
elseif input.KeyCode == Enum.KeyCode.A then
moveDirection = moveDirection - Vector3.new(-1, 0, 0)
elseif input.KeyCode == Enum.KeyCode.D then
moveDirection = moveDirection - Vector3.new(1, 0, 0)
elseif input.KeyCode == Enum.KeyCode.Space then
verticalVelocity = 0
elseif input.KeyCode == Enum.KeyCode.LeftShift then
verticalVelocity = 0
end
end)
RunService.RenderStepped:Connect(function()
if flying then
local camera = workspace.CurrentCamera
local camCFrame = camera.CFrame
local direction = (camCFrame.LookVector * moveDirection.Z) + (camCFrame.RightVector * moveDirection.X)
direction = direction.Unit * flySpeed
if moveDirection.Magnitude == 0 then
direction = Vector3.new(0,0,0)
end
bodyVelocity.Velocity = Vector3.new(direction.X, verticalVelocity, direction.Z)
else
bodyVelocity.Velocity = Vector3.new(0, 0, 0)
end
end)
LocalScript в папке StarterPlayer > StarterPlayerScripts.Если нужно, могу помочь доработать скрипт или объяснить как он работает!
Not yet included in a published release.