Advertisement
Guest User

23421-25112-25314

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