Advertisement
Guest User

aaaaaaaaaaaaaaaaaaaaaaaaaaa

a guest
Oct 20th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.61 KB | None | 0 0
  1. FLYING = false
  2. iyflyspeed = 1
  3. vehicleflyspeed = 1
  4. function sFLY(vfly)
  5. repeat wait() until Players.LocalPlayer and Players.LocalPlayer.Character and Players.LocalPlayer.Character:FindFirstChild('HumanoidRootPart') and Players.LocalPlayer.Character:FindFirstChild('Humanoid')
  6. repeat wait() until IYMouse
  7.  
  8. local T = Players.LocalPlayer.Character.HumanoidRootPart
  9. local CONTROL = {F = 0, B = 0, L = 0, R = 0, Q = 0, E = 0}
  10. local lCONTROL = {F = 0, B = 0, L = 0, R = 0, Q = 0, E = 0}
  11. local SPEED = 0
  12.  
  13. local function FLY()
  14. FLYING = true
  15. local BG = Instance.new('BodyGyro', T)
  16. local BV = Instance.new('BodyVelocity', T)
  17. BG.P = 9e4
  18. BG.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  19. BG.cframe = T.CFrame
  20. BV.velocity = Vector3.new(0, 0, 0)
  21. BV.maxForce = Vector3.new(9e9, 9e9, 9e9)
  22. spawn(function()
  23. repeat wait()
  24. if not vfly then
  25. Players.LocalPlayer.Character:FindFirstChildOfClass('Humanoid').PlatformStand = true
  26. end
  27. if CONTROL.L + CONTROL.R ~= 0 or CONTROL.F + CONTROL.B ~= 0 or CONTROL.Q + CONTROL.E ~= 0 then
  28. SPEED = 50
  29. elseif not (CONTROL.L + CONTROL.R ~= 0 or CONTROL.F + CONTROL.B ~= 0 or CONTROL.Q + CONTROL.E ~= 0) and SPEED ~= 0 then
  30. SPEED = 0
  31. end
  32. if (CONTROL.L + CONTROL.R) ~= 0 or (CONTROL.F + CONTROL.B) ~= 0 or (CONTROL.Q + CONTROL.E) ~= 0 then
  33. BV.velocity = ((workspace.CurrentCamera.CoordinateFrame.lookVector * (CONTROL.F + CONTROL.B)) + ((workspace.CurrentCamera.CoordinateFrame * CFrame.new(CONTROL.L + CONTROL.R, (CONTROL.F + CONTROL.B + CONTROL.Q + CONTROL.E) * 0.2, 0).p) - workspace.CurrentCamera.CoordinateFrame.p)) * SPEED
  34. lCONTROL = {F = CONTROL.F, B = CONTROL.B, L = CONTROL.L, R = CONTROL.R}
  35. elseif (CONTROL.L + CONTROL.R) == 0 and (CONTROL.F + CONTROL.B) == 0 and (CONTROL.Q + CONTROL.E) == 0 and SPEED ~= 0 then
  36. BV.velocity = ((workspace.CurrentCamera.CoordinateFrame.lookVector * (lCONTROL.F + lCONTROL.B)) + ((workspace.CurrentCamera.CoordinateFrame * CFrame.new(lCONTROL.L + lCONTROL.R, (lCONTROL.F + lCONTROL.B + CONTROL.Q + CONTROL.E) * 0.2, 0).p) - workspace.CurrentCamera.CoordinateFrame.p)) * SPEED
  37. else
  38. BV.velocity = Vector3.new(0, 0, 0)
  39. end
  40. BG.cframe = workspace.CurrentCamera.CoordinateFrame
  41. until not FLYING
  42. CONTROL = {F = 0, B = 0, L = 0, R = 0, Q = 0, E = 0}
  43. lCONTROL = {F = 0, B = 0, L = 0, R = 0, Q = 0, E = 0}
  44. SPEED = 0
  45. BG:destroy()
  46. BV:destroy()
  47. Players.LocalPlayer.Character:FindFirstChildOfClass('Humanoid').PlatformStand = false
  48. end)
  49. end
  50. IYMouse.KeyDown:connect(function(KEY)
  51. if KEY:lower() == 'w' then
  52. if vfly then
  53. CONTROL.F = vehicleflyspeed
  54. else
  55. CONTROL.F = iyflyspeed
  56. end
  57. elseif KEY:lower() == 's' then
  58. if vfly then
  59. CONTROL.B = - vehicleflyspeed
  60. else
  61. CONTROL.B = - iyflyspeed
  62. end
  63. elseif KEY:lower() == 'a' then
  64. if vfly then
  65. CONTROL.L = - vehicleflyspeed
  66. else
  67. CONTROL.L = - iyflyspeed
  68. end
  69. elseif KEY:lower() == 'd' then
  70. if vfly then
  71. CONTROL.R = vehicleflyspeed
  72. else
  73. CONTROL.R = iyflyspeed
  74. end
  75. elseif KEY:lower() == 'e' then
  76. if vfly then
  77. CONTROL.Q = vehicleflyspeed*2
  78. else
  79. CONTROL.Q = iyflyspeed*2
  80. end
  81. elseif KEY:lower() == 'q' then
  82. if vfly then
  83. CONTROL.E = -vehicleflyspeed*2
  84. else
  85. CONTROL.E = -iyflyspeed*2
  86. end
  87. end
  88. end)
  89. IYMouse.KeyUp:connect(function(KEY)
  90. if KEY:lower() == 'w' then
  91. CONTROL.F = 0
  92. elseif KEY:lower() == 's' then
  93. CONTROL.B = 0
  94. elseif KEY:lower() == 'a' then
  95. CONTROL.L = 0
  96. elseif KEY:lower() == 'd' then
  97. CONTROL.R = 0
  98. elseif KEY:lower() == 'e' then
  99. CONTROL.Q = 0
  100. elseif KEY:lower() == 'q' then
  101. CONTROL.E = 0
  102. end
  103. end)
  104. FLY()
  105. end
  106.  
  107. function NOFLY()
  108. FLYING = false
  109. Players.LocalPlayer.Character:FindFirstChildOfClass('Humanoid').PlatformStand = false
  110. end
  111.  
  112. addcmd('fly',{},
  113. function(args, speaker)
  114. NOFLY()
  115. wait()
  116. sFLY()
  117. end)
  118.  
  119. addcmd('flyspeed',{'flysp'},
  120. function(args, speaker)
  121. if isNumber(args[1]) then
  122. iyflyspeed = args[1]
  123. end
  124. end)
  125.  
  126. addcmd('unfly',{'nofly','novfly','unvehiclefly','novehiclefly','unvfly'},
  127. function(args, speaker)
  128. NOFLY()
  129. end)
  130.  
  131. addcmd('vfly',{'vehiclefly'},
  132. function(args, speaker)
  133. NOFLY()
  134. wait()
  135. sFLY(true)
  136. end)
  137.  
  138. addcmd('vflyspeed',{'vflysp','vehicleflyspeed','vehicleflysp'},
  139. function(args, speaker)
  140. if isNumber(args[1]) then
  141. vehicleflyspeed = args[1]
  142. end
  143. end)
  144.  
  145. addcmd('togglefly',{},
  146. function(args, speaker)
  147. if FLYING then
  148. NOFLY()
  149. else
  150. sFLY()
  151. end
  152. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement