Advertisement
TrollEZLOL

Untitled

Jun 4th, 2021
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1. game.StarterGui:SetCore("SendNotification",
  2. {
  3. Title = "TEST";
  4. Text = "TEST";
  5. Duration = 7
  6. }
  7. )
  8.  
  9. repeat wait()
  10. until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Head") and game.Players.LocalPlayer.Character:findFirstChild("Humanoid")
  11. local mouse = game.Players.LocalPlayer:GetMouse()
  12. repeat wait() until mouse
  13. local plr = game.Players.LocalPlayer
  14. local torso = plr.Character.Head
  15. local flying = false
  16. local deb = true
  17. local ctrl = {f = 0, b = 0, l = 0, r = 0}
  18. local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  19. local maxspeed = 400
  20. local speed = 5000
  21.  
  22. function Fly()
  23. local bg = Instance.new("BodyGyro", torso)
  24. bg.P = 9e4
  25. bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  26. bg.cframe = torso.CFrame
  27. local bv = Instance.new("BodyVelocity", torso)
  28. bv.velocity = Vector3.new(0,0.1,0)
  29. bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  30. repeat wait()
  31. plr.Character.Humanoid.PlatformStand = true
  32. if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
  33. speed = speed+.5+(speed/maxspeed)
  34. if speed > maxspeed then
  35. speed = maxspeed
  36. end
  37. elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then
  38. speed = speed-1
  39. if speed < 0 then
  40. speed = 0
  41. end
  42. end
  43. if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
  44. 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
  45. lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  46. elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then
  47. 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
  48. else
  49. bv.velocity = Vector3.new(0,0.1,0)
  50. end
  51. bg.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)
  52. until not flying
  53. ctrl = {f = 0, b = 0, l = 0, r = 0}
  54. lastctrl = {f = 0, b = 0, l = 0, r = 0}
  55. speed = 0
  56. bg:Destroy()
  57. bv:Destroy()
  58. plr.Character.Humanoid.PlatformStand = false
  59. end
  60. mouse.KeyDown:connect(function(key)
  61. if key:lower() == "e" then
  62. if flying then flying = false
  63. else
  64. flying = true
  65. Fly()
  66. end
  67. elseif key:lower() == "w" then
  68. ctrl.f = 1
  69. elseif key:lower() == "s" then
  70. ctrl.b = -1
  71. elseif key:lower() == "a" then
  72. ctrl.l = -1
  73. elseif key:lower() == "d" then
  74. ctrl.r = 1
  75. end
  76. end)
  77. mouse.KeyUp:connect(function(key)
  78. if key:lower() == "w" then
  79. ctrl.f = 0
  80. elseif key:lower() == "s" then
  81. ctrl.b = 0
  82. elseif key:lower() == "a" then
  83. ctrl.l = 0
  84. elseif key:lower() == "d" then
  85. ctrl.r = 0
  86. end
  87. end)
  88. Fly()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement