pelotudo
2
0local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChildOfClass("Humanoid")
local flying = false
local speed = 50 -- Velocidad de vuelo
-- Crear un BodyVelocity para el vuelo
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
local function startFlying()
flying = true
bodyVelocity.Parent = character.HumanoidRootPart
end
local function stopFlying()
flying = false
bodyVelocity.Parent = nil
end
-- Detectar cuando se presiona una tecla
game:GetService("UserInputService").InputBegan:Connect(function(input, processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.F then -- Presiona "F" para volar
if flying then
stopFlying()
else
startFlying()
end
end
end)
-- Control de vuelo
game:GetService("RunService").RenderStepped:Connect(function()
if flying then
bodyVelocity.Velocity = character.HumanoidRootPart.CFrame.LookVector * speed
end
end)
Follow