local player = game.Players.LocalPlayer local UIS = game:GetService("UserInputService") local RunService = game:GetService("RunService") local character = player.Character or player.CharacterAdded:Wait() local hrp = character:WaitForChild("HumanoidRootPart") local flying = false local speed = 80 local bv local bg function startFly() flying = true bv = Instance.new("BodyVelocity") bv.MaxForce = Vector3.new(1e5, 1e5, 1e5) bv.Parent = hrp bg = Instance.new("BodyGyro") bg.MaxTorque = Vector3.new(1e5, 1e5, 1e5) bg.Parent = hrp end function stopFly() flying = false if bv then bv:Destroy() end if bg then bg:Destroy() end end UIS.InputBegan:Connect(function(input, gp) if gp then return end if input.KeyCode == Enum.KeyCode.F then if flying then stopFly() else startFly() end end end) RunService.RenderStepped:Connect(function() if not flying then return end local cam = workspace.CurrentCamera local move = Vector3.zero if UIS:IsKeyDown(Enum.KeyCode.W) then move += cam.CFrame.LookVector end if UIS:IsKeyDown(Enum.KeyCode.S) then move -= cam.CFrame.LookVector end if UIS:IsKeyDown(Enum.KeyCode.A) then move -= cam.CFrame.RightVector end if UIS:IsKeyDown(Enum.KeyCode.D) then move += cam.CFrame.RightVector end if UIS:IsKeyDown(Enum.KeyCode.Space) then move += Vector3.new(0,1,0) end if UIS:IsKeyDown(Enum.KeyCode.LeftControl) then move -= Vector3.new(0,1,0) end bv.Velocity = move * speed bg.CFrame = cam.CFrame end)