Advertisement
pkgupdate

flt

Feb 9th, 2022
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. local uis = game:GetService("UserInputService")
  2. local rs = game:GetService("RunService")
  3.  
  4. local myPlayer = game.Players.LocalPlayer
  5. local myChar = myPlayer.Character
  6. local myHRP = myChar:WaitForChild("HumanoidRootPart")
  7. local camera = game.Workspace.CurrentCamera
  8.  
  9. local flying = false
  10. local speed = 0.5
  11.  
  12.  
  13. local bp = Instance.new("BodyPosition", myHRP)
  14. bp.MaxForce = Vector3.new()
  15. bp.D = 10
  16. bp.P = 10000
  17.  
  18. local bg = Instance.new("BodyGyro", myHRP)
  19. bg.MaxTorque = Vector3.new()
  20. bg.D = 10
  21.  
  22. function fly()
  23. flying = true
  24. bp.MaxForce = Vector3.new(400000,400000,400000)
  25. bg.MaxTorque = Vector3.new(400000,400000,400000)
  26. while flying do
  27. rs.RenderStepped:wait()
  28. bp.Position = myHRP.Position +((myHRP.Position - camera.CFrame.p).unit * speed)
  29. bg.CFrame = CFrame.new(camera.CFrame.p, myHRP.Position)
  30. end
  31. end
  32.  
  33. function endFlying()
  34. bp.MaxForce = Vector3.new()
  35. bg.MaxTorque = Vector3.new()
  36. flying = false
  37. end
  38.  
  39. uis.InputBegan:connect(function(input)
  40. if input.KeyCode == Enum.KeyCode.E then
  41. if not flying then
  42. fly()
  43. else
  44. endFlying()
  45. end
  46. end
  47. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement