Advertisement
Ufomodz101

not really my script but here

Apr 19th, 2020
4,224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
4CS 5.36 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2. local torso = plr.Character.Torso
  3. local flying = true
  4. local deb = true
  5. local ctrl = {f = 0, b = 0, l = 0, r = 0}
  6. local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  7. local maxspeed = 50
  8. local speed = 0
  9.  
  10. function Fly()
  11. local bg = Instance.new("BodyGyro", torso)
  12. bg.P = 9e4
  13. bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  14. bg.cframe = torso.CFrame
  15. local bv = Instance.new("BodyVelocity", torso)
  16. bv.velocity = Vector3.new(0,0.1,0)
  17. bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  18. repeat wait()
  19. plr.Character.Humanoid.PlatformStand = true
  20. if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
  21. speed = speed+.5+(speed/maxspeed)
  22. if speed > maxspeed then
  23. speed = maxspeed
  24. end
  25. elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then
  26. speed = speed-1
  27. if speed < 0 then
  28. speed = 0
  29. end
  30. end
  31. if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
  32. 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
  33. lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  34. elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then
  35. 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
  36. else
  37. bv.velocity = Vector3.new(0,0.1,0)
  38. end
  39. bg.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)
  40. until not flying
  41. ctrl = {f = 0, b = 0, l = 0, r = 0}
  42. lastctrl = {f = 0, b = 0, l = 0, r = 0}
  43. speed = 0
  44. bg:Destroy()
  45. bv:Destroy()
  46. plr.Character.Humanoid.PlatformStand = false
  47. end
  48. mouse.KeyDown:connect(function(key)
  49. if key:lower() == "e" then
  50. if flying then flying = false
  51. else
  52. flying = true
  53. Fly()
  54. end
  55. elseif key:lower() == "w" then
  56. ctrl.f = 1
  57. elseif key:lower() == "s" then
  58. ctrl.b = -1
  59. elseif key:lower() == "a" then
  60. ctrl.l = -1
  61. elseif key:lower() == "d" then
  62. ctrl.r = 1
  63. end
  64. end)
  65. mouse.KeyUp:connect(function(key)
  66. if key:lower() == "w" then
  67. ctrl.f = 0
  68. elseif key:lower() == "s" then
  69. ctrl.b = 0
  70. elseif key:lower() == "a" then
  71. ctrl.l = 0
  72. elseif key:lower() == "d" then
  73. ctrl.r = 0
  74. end
  75. end)
  76. Fly()
  77. RAW Paste Data
  78. repeat wait()
  79.     until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Torso") and game.Players.LocalPlayer.Character:findFirstChild("Humanoid")
  80. local mouse = game.Players.LocalPlayer:GetMouse()
  81. repeat wait() until mouse
  82. local plr = game.Players.LocalPlayer
  83. local torso = plr.Character.Torso
  84. local flying = true
  85. local deb = true
  86. local ctrl = {f = 0, b = 0, l = 0, r = 0}
  87. local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  88. local maxspeed = 50
  89. local speed = 0
  90.  
  91. function Fly()
  92. local bg = Instance.new("BodyGyro", torso)
  93. bg.P = 9e4
  94. bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  95. bg.cframe = torso.CFrame
  96. local bv = Instance.new("BodyVelocity", torso)
  97. bv.velocity = Vector3.new(0,0.1,0)
  98. bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  99. repeat wait()
  100. plr.Character.Humanoid.PlatformStand = true
  101. if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
  102. speed = speed+.5+(speed/maxspeed)
  103. if speed > maxspeed then
  104. speed = maxspeed
  105. end
  106. elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then
  107. speed = speed-1
  108. if speed < 0 then
  109. speed = 0
  110. end
  111. end
  112. if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
  113. 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
  114. lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  115. elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then
  116. 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
  117. else
  118. bv.velocity = Vector3.new(0,0.1,0)
  119. end
  120. bg.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)
  121. until not flying
  122. ctrl = {f = 0, b = 0, l = 0, r = 0}
  123. lastctrl = {f = 0, b = 0, l = 0, r = 0}
  124. speed = 0
  125. bg:Destroy()
  126. bv:Destroy()
  127. plr.Character.Humanoid.PlatformStand = false
  128. end
  129. mouse.KeyDown:connect(function(key)
  130. if key:lower() == "e" then
  131. if flying then flying = false
  132. else
  133. flying = true
  134. Fly()
  135. end
  136. elseif key:lower() == "w" then
  137. ctrl.f = 1
  138. elseif key:lower() == "s" then
  139. ctrl.b = -1
  140. elseif key:lower() == "a" then
  141. ctrl.l = -1
  142. elseif key:lower() == "d" then
  143. ctrl.r = 1
  144. end
  145. end)
  146. mouse.KeyUp:connect(function(key)
  147. if key:lower() == "w" then
  148. ctrl.f = 0
  149. elseif key:lower() == "s" then
  150. ctrl.b = 0
  151. elseif key:lower() == "a" then
  152. ctrl.l = 0
  153. elseif key:lower() == "d" then
  154. ctrl.r = 0
  155. end
  156. end)
  157. Fly()
  158. 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement