Advertisement
Godofadmin1337

fly test

Sep 30th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1.  
  2. local mouse=game.Players.LocalPlayer:GetMouse''
  3.  
  4. localplayer=game.Players.LocalPlayer
  5.  
  6. game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart")
  7.  
  8. local torso = game.Players.LocalPlayer.Character.HumanoidRootPart
  9.  
  10. local speed=0
  11.  
  12. local keys={a=false,d=false,w=false,s=false}
  13.  
  14. local e1
  15.  
  16. local e2
  17.  
  18. local function start()
  19.  
  20. local pos = Instance.new("BodyPosition",torso)
  21.  
  22. local gyro = Instance.new("BodyGyro",torso)
  23.  
  24. pos.Name="EPIXPOS"
  25.  
  26. pos.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  27.  
  28. pos.position = torso.Position
  29.  
  30. gyro.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  31.  
  32. gyro.cframe = torso.CFrame
  33.  
  34. repeat
  35.  
  36. wait()
  37.  
  38. localplayer.Character.Humanoid.PlatformStand=true
  39.  
  40. local new=gyro.cframe - gyro.cframe.p + pos.position
  41.  
  42. if not keys.w and not keys.s and not keys.a and not keys.d then
  43.  
  44. speed=1
  45.  
  46. end
  47.  
  48. if keys.w then
  49.  
  50. new = new + workspace.CurrentCamera.CoordinateFrame.lookVector * speed
  51.  
  52. speed=speed+0.01
  53.  
  54. end
  55.  
  56. if keys.s then
  57.  
  58. new = new - workspace.CurrentCamera.CoordinateFrame.lookVector * speed
  59.  
  60. speed=speed+0.01
  61.  
  62. end
  63.  
  64. if keys.d then
  65.  
  66. new = new * CFrame.new(speed,0,0)
  67.  
  68. speed=speed+0.01
  69.  
  70. end
  71.  
  72. if keys.a then
  73.  
  74. new = new * CFrame.new(-speed,0,0)
  75.  
  76. speed=speed+0.01
  77.  
  78. end
  79.  
  80. if speed>5 then
  81.  
  82. speed=5
  83.  
  84. end
  85.  
  86. pos.position=new.p
  87.  
  88. if keys.w then
  89.  
  90. gyro.cframe = workspace.CurrentCamera.CoordinateFrame*CFrame.Angles(-math.rad(speed*15),0,0)
  91.  
  92. elseif keys.s then
  93.  
  94. gyro.cframe = workspace.CurrentCamera.CoordinateFrame*CFrame.Angles(math.rad(speed*15),0,0)
  95.  
  96. else
  97.  
  98. gyro.cframe = workspace.CurrentCamera.CoordinateFrame
  99.  
  100. end
  101.  
  102. until not Fly
  103.  
  104. if gyro then gyro:Destroy() end
  105.  
  106. if pos then pos:Destroy() end
  107.  
  108. flying=false
  109.  
  110. localplayer.Character.Humanoid.PlatformStand=false
  111.  
  112. speed=0
  113.  
  114. end
  115.  
  116. e1=mouse.KeyDown:connect(function(key)
  117.  
  118. if not torso or not torso.Parent then flying=false e1:disconnect() e2:disconnect() return end
  119.  
  120. if key=="w" then
  121.  
  122. keys.w=true
  123.  
  124. elseif key=="s" then
  125.  
  126. keys.s=true
  127.  
  128. elseif key=="a" then
  129.  
  130. keys.a=true
  131.  
  132. elseif key=="d" then
  133.  
  134. keys.d=true
  135.  
  136. end
  137.  
  138. end)
  139.  
  140. e2=mouse.KeyUp:connect(function(key)
  141.  
  142. if key=="w" then
  143.  
  144. keys.w=false
  145.  
  146. elseif key=="s" then
  147.  
  148. keys.s=false
  149.  
  150. elseif key=="a" then
  151.  
  152. keys.a=false
  153.  
  154. elseif key=="d" then
  155.  
  156. keys.d=false
  157.  
  158. end
  159.  
  160. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement