local player = game.Players.LocalPlayer local mouse = player:GetMouse() local flying = false local speed = 50 local bv local bg mouse.KeyDown:Connect(function(key) if key:lower() == "e" then flying = not flying if flying then local char = player.Character or player.CharacterAdded:Wait() local hrp = char:WaitForChild("HumanoidRootPart") bv = Instance.new("BodyVelocity") bv.Velocity = Vector3.new(0,0,0) bv.MaxForce = Vector3.new(40000,40000,40000) bv.Parent = hrp bg = Instance.new("BodyGyro") bg.MaxTorque = Vector3.new(40000,40000,40000) bg.P = 9000 bg.Parent = hrp while flying and char:FindFirstChild("HumanoidRootPart") do local direction = Vector3.new() if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.W) then direction = direction + hrp.CFrame.LookVector end if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.S) then direction = direction - hrp.CFrame.LookVector end if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.A) then direction = direction - hrp.CFrame.RightVector end if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.D) then direction = direction + hrp.CFrame.RightVector end if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.Space) then direction = direction + Vector3.new(0,1,0) end if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.LeftControl) then direction = direction - Vector3.new(0,1,0) end bv.Velocity = direction.Unit * speed bg.CFrame = workspace.CurrentCamera.CFrame wait() end else if bv then bv:Destroy() end if bg then bg:Destroy() end end end end)