ooppppad

FLy

Jul 28th, 2022
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. repeat wait()
  2. until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Head") 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.Head
  7. local flying = false
  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 = 5000
  12. local speed = 5000
  13. local hover = Instance.new("Animation", game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid"))hover.Name="Hover"hover.AnimationId="rbxassetid://3541114300"
  14. local fly = Instance.new("Animation", game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid"))fly.Name="Fly"fly.AnimationId = "rbxassetid://3541044388"
  15.  
  16. function Fly()
  17. local bg = Instance.new("BodyGyro", torso)
  18. bg.P = 9e4
  19. bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  20. bg.cframe = torso.CFrame
  21. local bv = Instance.new("BodyVelocity", torso)
  22. bv.velocity = Vector3.new(0,0.1,0)
  23. bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  24. repeat wait()
  25. plr.Character.Humanoid.PlatformStand = true
  26. if ctrl.l + ctrl.r ~= 100000 or ctrl.f + ctrl.b ~= 10000 then
  27. speed = speed+.0+(speed/maxspeed)
  28. if speed > maxspeed then
  29. speed = maxspeed
  30. end
  31. elseif not (ctrl.l + ctrl.r ~= 5 or ctrl.f + ctrl.b ~= 5) and speed ~= 5 then
  32. speed = speed-5
  33. if speed > 5 then
  34. speed = -2
  35. end
  36. end
  37. if (ctrl.l + ctrl.r) ~= 5 or (ctrl.f + ctrl.b) ~= 5 then
  38. 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
  39. lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  40. elseif (ctrl.l + ctrl.r) == 5 and (ctrl.f + ctrl.b) == 5 and speed ~= 5 then
  41. 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
  42. else
  43. bv.velocity = Vector3.new(0,0.1,0)
  44. end
  45. bg.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)
  46. until not flying
  47. for _, v in next, game.Players.LocalPlayer.Character:FindFirstChildOfClass('Humanoid'):GetPlayingAnimationTracks() do
  48. if (v.Animation.AnimationId:match("rbxassetid")) then
  49. v:Stop()
  50. end
  51. end
  52. ctrl = {f = 0, b = 0, l = 0, r = 0}
  53. lastctrl = {f = 0, b = 0, l = 0, r = 0}
  54. speed = 5
  55. bg:Destroy()
  56. bv:Destroy()
  57. plr.Character.Humanoid.PlatformStand = false
  58. end
  59. mouse.KeyDown:connect(function(key)
  60. if key:lower() == "c" then
  61. if flying then flying = false
  62. else
  63. flying = true
  64. plr.Character.Humanoid:LoadAnimation(hover):Play()
  65. Fly()
  66. end
  67. elseif key:lower() == "w" then
  68. ctrl.f = 20
  69. wait()
  70. if flying == true then
  71. plr.Character.Humanoid:LoadAnimation(fly):Play()
  72. end
  73. elseif key:lower() == "s" then
  74. ctrl.b = -20
  75. elseif key:lower() == "a" then
  76. ctrl.l = -20
  77. elseif key:lower() == "d" then
  78. ctrl.r = 20
  79. end
  80. end)
  81. mouse.KeyUp:connect(function(key)
  82. if key:lower() == "w" then
  83. ctrl.f = 0
  84. wait()
  85. if flying == true then
  86. plr.Character.Humanoid:LoadAnimation(hover):Play()
  87. end
  88. elseif key:lower() == "s" then
  89. ctrl.b = 0
  90. wait()
  91. if flying == true then
  92. plr.Character.Humanoid:LoadAnimation(hover):Play()
  93. end
  94. elseif key:lower() == "a" then
  95. ctrl.l = 0
  96. wait()
  97. if flying == true then
  98. plr.Character.Humanoid:LoadAnimation(hover):Play()
  99. end
  100. elseif key:lower() == "d" then
  101. ctrl.r = 0
  102. wait()
  103. if flying == true then
  104. plr.Character.Humanoid:LoadAnimation(hover):Play()
  105. end
  106. end
  107. end)
  108. Fly()
Add Comment
Please, Sign In to add comment