lualocal UIS = game:GetService("UserInputService") local RunService = game:GetService("RunService") local Players = game:GetService("Players") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local root = character:WaitForChild("HumanoidRootPart") local flying = false local speed = 60 local lv local ao local attachment local function startFlying() flying = true -- Create attachment for constraints if it doesn't exist attachment = root:FindFirstChild("FlightAttachment") if not attachment then attachment = Instance.new("Attachment") attachment.Name = "FlightAttachment" attachment.Parent = root end -- Modern LinearVelocity lv = Instance.new("LinearVelocity") lv.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector lv.MaxForce = math.huge lv.VectorVelocity = Vector3.zero lv.Attachment0 = attachment lv.Parent = root -- Modern AlignOrientation ao = Instance.new("AlignOrientation") ao.Mode = Enum.AlignOrientationMode.OneAttachment ao.RigidityEnabled = true ao.Attachment0 = attachment ao.Parent = root humanoid.PlatformStand = true end local function stopFlying() flying = false if lv then lv:Destroy() end if ao then ao:Destroy() end if attachment then attachment:Destroy() end humanoid.PlatformStand = false end UIS.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.F then if flying then stopFlying() else startFlying() end end end) RunService.RenderStepped:Connect(function() if not flying then return end local cam = workspace.CurrentCamera local moveDirection = Vector3.zero if UIS:IsKeyDown(Enum.KeyCode.W) then moveDirection += cam.CFrame.LookVector end if UIS:IsKeyDown(Enum.KeyCode.S) then moveDirection -= cam.CFrame.LookVector end if UIS:IsKeyDown(Enum.KeyCode.A) then moveDirection -= cam.CFrame.RightVector end if UIS:IsKeyDown(Enum.KeyCode.D) then moveDirection += cam.CFrame.RightVector end if UIS:IsKeyDown(Enum.KeyCode.Space) then moveDirection += Vector3.new(0, 1, 0) end if UIS:IsKeyDown(Enum.KeyCode.LeftControl) then moveDirection -= Vector3.new(0, 1, 0) end if moveDirection.Magnitude > 0 then lv.VectorVelocity = moveDirection.Unit * speed else lv.VectorVelocity = Vector3.zero end ao.CFrame = cam.CFrame end) player.CharacterAdded:Connect(function(char) character = char humanoid = char:WaitForChild("Humanoid") root = char:WaitForChild("HumanoidRootPart") stopFlying() end)