SHARE
TWEET

Untitled

a guest Apr 20th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. repeat wait()Â
  2.  until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Torso") and game.Players.LocalPlayer.Character:findFirstChild("Humanoid")Â
  3. local mouse = game.Players.LocalPlayer:GetMouse()Â
  4. repeat wait() until mouse
  5. local plr = game.Players.LocalPlayerÂ
  6. local torso = plr.Character.TorsoÂ
  7. local flying = true
  8. local deb = trueÂ
  9. local ctrl = {f = 0, b = 0, l = 0, r = 0}Â
  10. local lastctrl = {f = 0, b = 0, l = 0, r = 0}Â
  11. local maxspeed = 50Â
  12. local speed = 0Â
  13.  
  14. function Fly()Â
  15. local bg = Instance.new("BodyGyro", torso)Â
  16. bg.P = 9e4Â
  17. bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)Â
  18. bg.cframe = torso.CFrameÂ
  19. local bv = Instance.new("BodyVelocity", torso)Â
  20. bv.velocity = Vector3.new(0,0.1,0)Â
  21. bv.maxForce = Vector3.new(9e9, 9e9, 9e9)Â
  22. repeat wait()Â
  23. plr.Character.Humanoid.PlatformStand = trueÂ
  24. if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 thenÂ
  25. speed = speed+.5+(speed/maxspeed)Â
  26. if speed > maxspeed thenÂ
  27. speed = maxspeedÂ
  28. endÂ
  29. elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 thenÂ
  30. speed = speed-1Â
  31. if speed < 0 thenÂ
  32. speed = 0Â
  33. endÂ
  34. endÂ
  35. if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 thenÂ
  36. bv.velocity = ((game.Workspace.CurrentCamera.CoordinateFrame.lookVector * (ctrl.f+ctrl.b)) + ((game.Workspace.CurrentCamera.CoordinateFrame * CFrame.new(ctrl.l+ctrl.r,(ctrl.f+ctrl.b)*.2,0).p) - game.Workspace.CurrentCamera.CoordinateFrame.p))*speedÂ
  37. lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}Â
  38. elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 thenÂ
  39. bv.velocity = ((game.Workspace.CurrentCamera.CoordinateFrame.lookVector * (lastctrl.f+lastctrl.b)) + ((game.Workspace.CurrentCamera.CoordinateFrame * CFrame.new(lastctrl.l+lastctrl.r,(lastctrl.f+lastctrl.b)*.2,0).p) - game.Workspace.CurrentCamera.CoordinateFrame.p))*speedÂ
  40. elseÂ
  41. bv.velocity = Vector3.new(0,0.1,0)Â
  42. endÂ
  43. bg.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)Â
  44. until not flyingÂ
  45. ctrl = {f = 0, b = 0, l = 0, r = 0}Â
  46. lastctrl = {f = 0, b = 0, l = 0, r = 0}Â
  47. speed = 0Â
  48. bg:Destroy()Â
  49. bv:Destroy()Â
  50. plr.Character.Humanoid.PlatformStand = falseÂ
  51. endÂ
  52. mouse.KeyDown:connect(function(key)Â
  53. if key:lower() == "e" thenÂ
  54. if flying then flying = falseÂ
  55. elseÂ
  56. flying = trueÂ
  57. Fly()Â
  58. endÂ
  59. elseif key:lower() == "w" thenÂ
  60. ctrl.f = 1Â
  61. elseif key:lower() == "s" thenÂ
  62. ctrl.b = -1Â
  63. elseif key:lower() == "a" thenÂ
  64. ctrl.l = -1Â
  65. elseif key:lower() == "d" thenÂ
  66. ctrl.r = 1Â
  67. endÂ
  68. end)Â
  69. mouse.KeyUp:connect(function(key)Â
  70. if key:lower() == "w" thenÂ
  71. ctrl.f = 0Â
  72. elseif key:lower() == "s" thenÂ
  73. ctrl.b = 0Â
  74. elseif key:lower() == "a" thenÂ
  75. ctrl.l = 0Â
  76. elseif key:lower() == "d" thenÂ
  77. ctrl.r = 0Â
  78. endÂ
  79. end)
  80. Fly()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top