local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local mouse = player:GetMouse() local flying = false local flySpeed = 50 local bodyVel = nil local bodyGyro = nil local function startFly() local char = player.Character if not char then return end local hrp = char:FindFirstChild("HumanoidRootPart") local humanoid = char:FindFirstChildOfClass("Humanoid") if not hrp or not humanoid then return end humanoid.PlatformStand = true bodyVel = Instance.new("BodyVelocity") bodyVel.MaxForce = Vector3.new(math.huge, math.huge, math.huge) bodyVel.Velocity = Vector3.zero bodyVel.Parent = hrp bodyGyro = Instance.new("BodyGyro") bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge) bodyGyro.P = 10000 bodyGyro.Parent = hrp flying = true end local function stopFly() local char = player.Character if char then local humanoid = char:FindFirstChildOfClass("Humanoid") if humanoid then humanoid.PlatformStand = false end end if bodyVel then bodyVel:Destroy() bodyVel = nil end if bodyGyro then bodyGyro:Destroy() bodyGyro = nil end flying = false end UserInputService.InputBegan:Connect(function(input, gpe) if gpe then return end if input.KeyCode == Enum.KeyCode.F then if flying then stopFly() else startFly() end end if input.KeyCode == Enum.KeyCode.T then local char = player.Character if char and char:FindFirstChild("HumanoidRootPart") then local target = mouse.Hit.Position + Vector3.new(0, 3, 0) char.HumanoidRootPart.CFrame = CFrame.new(target) end end end) RunService.RenderStepped:Connect(function() if not flying or not bodyVel or not bodyGyro then return end local char = player.Character if not char then return end local hrp = char:FindFirstChild("HumanoidRootPart") if not hrp then return end local cam = workspace.CurrentCamera local moveDir = Vector3.zero if UserInputService:IsKeyDown(Enum.KeyCode.W) then moveDir = moveDir + cam.CFrame.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.S) then moveDir = moveDir - cam.CFrame.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.A) then moveDir = moveDir - cam.CFrame.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.D) then moveDir = moveDir + cam.CFrame.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.Space) then moveDir = moveDir + Vector3.new(0, 1, 0) end if UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then moveDir = moveDir - Vector3.new(0, 1, 0) end if moveDir.Magnitude > 0 then moveDir = moveDir.Unit * flySpeed end bodyVel.Velocity = moveDir bodyGyro.CFrame = cam.CFrame end) player.CharacterAdded:Connect(function() stopFly() end)