local player = [Link].
LocalPlayer
local character = [Link] or [Link]:Wait()
local humanoid = character:WaitForChild("Humanoid")
local rootPart = character:WaitForChild("HumanoidRootPart")
local camera = [Link]
local flying = false
local flySpeed = 50 -- Adjust fly speed here
local bodyVelocity
local bodyGyro
-- Function to start flying
local function startFlying()
if not flying then
flying = true
[Link] = 0 -- Disable walking
[Link] = true -- Smooth flying
bodyVelocity = [Link]("BodyVelocity")
[Link] = [Link](0, 0, 0)
[Link] = [Link](40000, 40000, 40000)
[Link] = rootPart
bodyGyro = [Link]("BodyGyro")
bodyGyro.P = 3000
[Link] = [Link](40000, 40000, 40000)
[Link] = rootPart
end
end
-- Function to stop flying
local function stopFlying()
if flying then
flying = false
[Link] = 16 -- Restore default walk speed
[Link] = false
if bodyVelocity then bodyVelocity:Destroy() end
if bodyGyro then bodyGyro:Destroy() end
end
end
-- Toggle flying with "F" key
game:GetService("UserInputService").InputBegan:Connect(function(input,
gameProcessed)
if not gameProcessed and [Link] == [Link].F then
if flying then
stopFlying()
else
startFlying()
end
end
end)
-- Control movement with W, A, S, D
game:GetService("RunService").RenderStepped:Connect(function()
if flying then
local moveDirection = [Link]()
local camLook = [Link]
local camRight = [Link]
-- WASD movement
if game:GetService("UserInputService"):IsKeyDown([Link].W) then
moveDirection = moveDirection + camLook
end
if game:GetService("UserInputService"):IsKeyDown([Link].S) then
moveDirection = moveDirection - camLook
end
if game:GetService("UserInputService"):IsKeyDown([Link].A) then
moveDirection = moveDirection - camRight
end
if game:GetService("UserInputService"):IsKeyDown([Link].D) then
moveDirection = moveDirection + camRight
end
-- Apply velocity or hover
if [Link] > 0 then
[Link] = [Link] * flySpeed
else
[Link] = [Link](0, 0, 0) -- Hover in place
end
-- Align with camera
[Link] = [Link]
end
end)