Advertisement
StenHisDirt

Fly

Sep 29th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. Speed = 2
  2. Force = 800000
  3.  
  4. --Script:
  5. lplayer = game:GetService("Players").LocalPlayer
  6. Mouse = lplayer:GetMouse()
  7. speedfly = Speed
  8. T = lplayer.Character.HumanoidRootPart
  9. CONTROL = {F = 0, B = 0, L = 0, R = 0}
  10. lCONTROL = {F = 0, B = 0, L = 0, R = 0}
  11.  
  12. local function fly()
  13. flying = true
  14. local BG = Instance.new('BodyGyro', T)
  15. local BV = Instance.new('BodyVelocity', T)
  16. BG.P = 9e4
  17. BG.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  18. BG.cframe = T.CFrame
  19. BV.velocity = Vector3.new(0, 0.1, 0)
  20. BV.maxForce = Vector3.new(9e9, 9e9, 9e9)
  21. spawn(function()
  22. repeat wait()
  23. lplayer.Character.Humanoid.PlatformStand = true
  24. if CONTROL.L + CONTROL.R ~= 0 or CONTROL.F + CONTROL.B ~= 0 then
  25. SPEED = 50
  26. elseif not (CONTROL.L + CONTROL.R ~= 0 or CONTROL.F + CONTROL.B ~= 0) and SPEED ~= 0 then
  27. SPEED = 0
  28. end
  29. if (CONTROL.L + CONTROL.R) ~= 0 or (CONTROL.F + CONTROL.B) ~= 0 then
  30. BV.velocity = ((workspace.CurrentCamera.CoordinateFrame.lookVector * (CONTROL.F + CONTROL.B)) + ((workspace.CurrentCamera.CoordinateFrame * CFrame.new(CONTROL.L + CONTROL.R, (CONTROL.F + CONTROL.B) * 0.2, 0).p) - workspace.CurrentCamera.CoordinateFrame.p)) * SPEED
  31. lCONTROL = {F = CONTROL.F, B = CONTROL.B, L = CONTROL.L, R = CONTROL.R}
  32. elseif (CONTROL.L + CONTROL.R) == 0 and (CONTROL.F + CONTROL.B) == 0 and SPEED ~= 0 then
  33. BV.velocity = ((workspace.CurrentCamera.CoordinateFrame.lookVector * (lCONTROL.F + lCONTROL.B)) + ((workspace.CurrentCamera.CoordinateFrame * CFrame.new(lCONTROL.L + lCONTROL.R, (lCONTROL.F + lCONTROL.B) * 0.2, 0).p) - workspace.CurrentCamera.CoordinateFrame.p)) * SPEED
  34. else
  35. BV.velocity = Vector3.new(0, 0.1, 0)
  36. end
  37. BG.cframe = workspace.CurrentCamera.CoordinateFrame
  38. until not flying
  39. CONTROL = {F = 0, B = 0, L = 0, R = 0}
  40. lCONTROL = {F = 0, B = 0, L = 0, R = 0}
  41. SPEED = 0
  42. BG:destroy()
  43. BV:destroy()
  44. lplayer.Character.Humanoid.PlatformStand = false
  45. end)
  46. end
  47. Mouse.KeyDown:connect(function(KEY)
  48. if KEY:lower() == 'w' then
  49. CONTROL.F = speedfly
  50. elseif KEY:lower() == 's' then
  51. CONTROL.B = -speedfly
  52. elseif KEY:lower() == 'a' then
  53. CONTROL.L = -speedfly
  54. elseif KEY:lower() == 'd' then
  55. CONTROL.R = speedfly
  56. end
  57. end)
  58. Mouse.KeyUp:connect(function(KEY)
  59. if KEY:lower() == 'w' then
  60. CONTROL.F = 0
  61. elseif KEY:lower() == 's' then
  62. CONTROL.B = 0
  63. elseif KEY:lower() == 'a' then
  64. CONTROL.L = 0
  65. elseif KEY:lower() == 'd' then
  66. CONTROL.R = 0
  67. end
  68. end)
  69. fly()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement