Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.84 KB | None | 0 0
  1. wait(3)
  2. local uis = game:GetService("UserInputService")
  3. local suiton = false
  4. local ejected = false
  5. local used = false
  6. local flying=false
  7. local toggle = false
  8. local waiting = false
  9. local waiting2 = false
  10. local hassuit = false
  11. local used2 = false
  12.  
  13.  
  14. script.Done.Changed:Connect(function()
  15. if script.Done.Value == true then
  16. used = true
  17. hassuit = true
  18. suiton = true
  19. script.Suiton.Value = true
  20. end
  21. end)
  22.  
  23. --Eject/PutOnSuit
  24. uis.InputBegan:Connect(function(input,gameProcessedEvent)
  25.  
  26. if input.UserInputType == Enum.UserInputType.Keyboard then
  27. if input.KeyCode == Enum.KeyCode.N and not gameProcessedEvent then
  28. if waiting2 == false then
  29. if suiton == true then
  30. script.Suiton.Value = false
  31. waiting2 = true
  32. script.Parent.Remotes.Eject:FireServer()
  33. ejected = true
  34. suiton = false
  35. wait(6)
  36. waiting2 = false
  37. else if ejected == true then
  38. suiton = true
  39. script.Suiton.Value = true
  40. script.Parent.Remotes.EquipSuit:FireServer()
  41. wait(6)
  42. waiting2 = false
  43. suiton = true
  44. script.Suiton.Value = true
  45. script.Parent.Remotes.EquipSuit:FireServer()
  46. wait(6)
  47. waiting2 = false
  48. end
  49.  
  50. end
  51. end
  52. end
  53. end
  54. end)
  55.  
  56. --ToggleMask
  57. uis.InputBegan:Connect(function(input,gameProcessedEvent)
  58. if input.UserInputType == Enum.UserInputType.Keyboard then
  59. if input.KeyCode == Enum.KeyCode.M and not gameProcessedEvent then
  60. if suiton == true then
  61. if waiting == false then
  62. if toggle == false then
  63.  
  64. waiting = true
  65. script.Parent.Remotes.ToggleMaskUp:FireServer()
  66. wait(0.2)
  67. toggle = true
  68. print("e")
  69. wait(2)
  70. waiting = false
  71. else
  72. if waiting == false then
  73. waiting = true
  74. print("e2")
  75. script.Parent.Remotes.ToggleMaskDown:FireServer()
  76. wait(0.2)
  77. toggle = false
  78. wait(2)
  79. waiting = false
  80. end
  81. end
  82. end
  83. end
  84. end
  85.  
  86. end
  87. end)
  88. local CoolDownRight = false
  89. --Right Repulsor
  90. uis.InputBegan:Connect(function(input,gameProcessedEvent)
  91. if input.UserInputType == Enum.UserInputType.Keyboard then
  92. if input.KeyCode == Enum.KeyCode.E and not gameProcessedEvent then
  93. if suiton == true then
  94. if CoolDownRight == false then
  95. CoolDownRight = true
  96. local mouse = game.Players.LocalPlayer:GetMouse()
  97. script.Parent.Remotes.RightRepulsorSound:FireServer()
  98. wait(1.2)
  99. script.Parent.Remotes.ChestRepulsorShoot:FireServer(mouse.Hit)
  100. wait(2.8)
  101. CoolDownRight = false
  102. end
  103. end
  104. end
  105. end
  106. end)
  107. local CoolDownLeft = false
  108. --Left Repulsor
  109. uis.InputBegan:Connect(function(input,gameProcessedEvent)
  110. if input.UserInputType == Enum.UserInputType.Keyboard then
  111. if input.KeyCode == Enum.KeyCode.Q and not gameProcessedEvent then
  112. if suiton == true then
  113. if CoolDownLeft == false then
  114. CoolDownLeft = true
  115. local mouse = game.Players.LocalPlayer:GetMouse()
  116. script.Parent.Remotes.LeftRepulsorSound:FireServer()
  117. wait(1.2)
  118. script.Parent.Remotes.LeftRepulsorShoot:FireServer(mouse.Hit)
  119. wait(2.8)
  120. CoolDownLeft = false
  121. end
  122. end
  123. end
  124. end
  125. end)
  126. local CoolDownChest = false
  127. --Chest Repulsor
  128. uis.InputBegan:Connect(function(input,gameProcessedEvent)
  129. if input.UserInputType == Enum.UserInputType.Keyboard then
  130. if input.KeyCode == Enum.KeyCode.R and not gameProcessedEvent then
  131. if suiton == true then
  132. if CoolDownChest == false then
  133. CoolDownChest = true
  134. local mouse = game.Players.LocalPlayer:GetMouse()
  135. script.Parent.Remotes.ChestRepulsorSound:FireServer()
  136. wait(1.481)
  137. script.Parent.Remotes.ChestRepulsorShoot:FireServer(mouse.Hit)
  138. wait(5)
  139. CoolDownChest = false
  140. end
  141. end
  142. end
  143. end
  144. end)
  145.  
  146. --Explode Suit
  147. uis.InputBegan:Connect(function(input,gameProcessedEvent)
  148. if input.UserInputType == Enum.UserInputType.Keyboard then
  149. if input.KeyCode == Enum.KeyCode.P and not gameProcessedEvent then
  150. if suiton == false then
  151. if hassuit == true then
  152. if ejected == true then
  153. if used2 == false then
  154. script.Parent.Remotes.ExplodeSuit:FireServer()
  155. used2 = true
  156. wait(10)
  157. script.Suiton.Value = false
  158. suiton = false
  159. hassuit = false
  160. used = false
  161. waiting = false
  162. waiting2 = false
  163. ejected = false
  164. used2 = false
  165. script.Done = false
  166. game.Players.LocalPlayer.PlayerGui.IronmanChoose.ScrollingFrame.Clicked.Value = false
  167. end
  168. end
  169. end
  170. end
  171. end
  172. end
  173. end)
  174. script.Suiton.Changed:Connect(function()
  175. if script.Suiton.Value == true then
  176. sp=script
  177. plr=game.Players.LocalPlayer
  178. mouse=plr:GetMouse()
  179.  
  180. local speed=25
  181. local topspeed=150
  182.  
  183. local rate=math.huge/math.huge
  184.  
  185. local inertia=1-(speed/topspeed)
  186. local debris=game:GetService("Debris")
  187. local controls={forward=0,backward=0,left=0,right=0}
  188. local momentum=Vector3.new(0,0,0)
  189. local lastmomentum=Vector3.new(0,0,0)
  190. local totalmomentum=0
  191. local tilt=0
  192. local lasttilt=0
  193.  
  194. local anim=script:WaitForChild("IdleANIM_Fly")
  195. local anim2=script:WaitForChild("FowardANIM_Fly")
  196. local hum = plr.Character:WaitForChild("Humanoid")
  197. local Forward = hum:LoadAnimation(anim2)
  198. local Forward2 = hum:LoadAnimation(anim2)
  199. local Forward3 = hum:LoadAnimation(anim2)
  200. local Forward4 = hum:LoadAnimation(anim2)
  201. function RemoveFlyStuff()
  202. if plr and plr.Character then
  203. local torso=plr.Character:FindFirstChild("UpperTorso")
  204. if torso~=nil then
  205. for _,v in pairs(torso:GetChildren()) do
  206. if v and (v.Name=="FlightGyro" or v.Name=="FlightVelocity") then
  207. v:remove()
  208. end
  209. end
  210. end
  211. end
  212. if flyanim~=nil then
  213. flyanim:Stop()
  214. end
  215. end
  216.  
  217. function fly() --(de)activate fly mode
  218. flying=not flying
  219. RemoveFlyStuff()
  220. if flying then
  221. if plr and plr.Character then
  222.  
  223. local torso=plr.Character:FindFirstChild("UpperTorso")
  224. local humanoid=plr.Character:FindFirstChild("Humanoid")
  225. if torso and humanoid and humanoid.Health>0 then
  226. momentum=torso.Velocity+(torso.CFrame.lookVector*10)+Vector3.new(0,10,0)
  227. plr.Character.Humanoid.PlatformStand = true
  228. plr.Character.Sounds.StartFly:Play()
  229. plr.Character.Sounds.Inair:Play()
  230. script.Flying.Value = true
  231. script.Parent.Remotes.FlyEffects:FireServer()
  232. local gyro=Instance.new("BodyGyro")
  233. gyro.Name="FlightGyro"
  234. gyro.P=10^4
  235. gyro.maxTorque=Vector3.new(gyro.P,gyro.P,gyro.P)
  236. gyro.cframe=torso.CFrame
  237. gyro.Parent=torso
  238.  
  239. velocity=Instance.new("BodyVelocity")
  240. velocity.Name="FlightVelocity"
  241. velocity.velocity=Vector3.new(0,0,0)
  242. velocity.P=10^3
  243. velocity.maxForce=Vector3.new(1,1,1)*(10^6)
  244. velocity.Parent=torso
  245. flyanim=humanoid:LoadAnimation(anim)
  246. if flyanim~=nil then
  247. flyanim:Stop()
  248. end
  249.  
  250. if flyanim then
  251. flyanim:Play()
  252. end
  253.  
  254. while flying and torso and humanoid and humanoid.Health>0 do
  255. local movement=game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(Vector3.new(controls.left+controls.right,math.abs(controls.forward)*.2,controls.forward+controls.backward))*speed
  256.  
  257. momentum=(momentum*inertia)+movement
  258. totalmomentum=momentum.magnitude
  259. if totalmomentum>topspeed then
  260. totalmomentum=topspeed
  261. end
  262.  
  263. local tilt=((momentum*Vector3.new(1,0,1)).unit:Cross(((lastmomentum*Vector3.new(1,0,1)).unit))).y
  264. local tstilt=tostring(tilt)
  265. if tstilt=="-1.#IND" or tstilt=="1.#IND" or tilt==math.huge or tilt==-math.huge or tstilt==tostring(0/0) then
  266. tilt=0
  267. end
  268.  
  269. local abstilt=math.abs(tilt)
  270. if abstilt>.06 or abstilt<.0001 then
  271. if math.abs(lasttilt)>.0001 then
  272. tilt=lasttilt*.9
  273. else
  274. tilt=0
  275. end
  276. else
  277. tilt=(lasttilt*.77)+(tilt*.25) --weighted average
  278. end
  279. lasttilt=tilt
  280.  
  281. if totalmomentum<.5 then
  282. momentum=Vector3.new(0,0,0)
  283. totalmomentum=0
  284. gyro.cframe=game.Workspace.CurrentCamera.CoordinateFrame
  285. else
  286. gyro.cframe=CFrame.new(Vector3.new(0,0,0),momentum)*CFrame.Angles(0,0,tilt*(-20))*CFrame.Angles(math.pi*(-.5)*(totalmomentum/topspeed),0,0)
  287. end
  288. velocity.velocity=momentum
  289. lastmomentum=momentum
  290. wait(rate)
  291. end
  292. RemoveFlyStuff()
  293. flying=false
  294. script.Flying.Value = false
  295. plr.Character.Humanoid.PlatformStand = false
  296. plr.Character.Sounds.Inair:Stop()
  297. script.Parent.Remotes.RemoveFlyEffects:FireServer()
  298. end
  299. end
  300. end
  301. end
  302. script.Flying.Changed:Connect(function()
  303. if script.Flying.Value == false then
  304. RemoveFlyStuff()
  305. flying=false
  306. script.Flying.Value = false
  307. plr.Character.Humanoid.PlatformStand = false
  308. while script.Flying.Value == false do
  309. flyanim:Stop()
  310. Forward:Stop()
  311. script.Parent.Remotes.RemoveFlyEffects:FireServer()
  312. wait()
  313. end
  314. end
  315. end)
  316. local IsFlying = false
  317.  
  318.  
  319.  
  320. while true do
  321. wait()
  322. if plr and plr.Character and plr.Character.Parent==game.Workspace then
  323. break
  324. end
  325. end
  326. mouse.KeyDown:connect(function(Key)
  327.  
  328. if Key == "f" then
  329. mouse.KeyDown:connect(function(key2)
  330. local key=string.byte(key2)
  331. if key==32 then --Space bar
  332.  
  333. IsFlying = not IsFlying
  334. elseif key==string.byte("w") or key==17 then
  335. controls.forward=-1
  336. if flying == true then
  337. script.Parent.Remotes.FlyEffects2:FireServer()
  338. Forward:Play()
  339. end
  340. elseif key==string.byte("a") or key==20 then
  341. controls.left=-1
  342. if flying == true then
  343. script.Parent.Remotes.FlyEffects2:FireServer()
  344. Forward2:Play()
  345. end
  346. elseif key==string.byte("s") or key==18 then
  347. controls.backward=1
  348. if flying == true then
  349. script.Parent.Remotes.FlyEffects2:FireServer()
  350. Forward3:Play()
  351. end
  352. elseif key==string.byte("d") or key==19 then
  353. controls.right=1
  354. if flying == true then
  355. script.Parent.Remotes.FlyEffects2:FireServer()
  356. Forward4:Play()
  357. end
  358. end
  359. end)
  360. mouse.KeyUp:connect(function(key2)
  361. local key=string.byte(key2)
  362. if key==string.byte("w") or key==17 then
  363. controls.forward=0
  364.  
  365. Forward:Stop()
  366. script.Parent.Remotes.FlyEffects:FireServer()
  367. elseif key==string.byte("a") or key==20 then
  368. controls.left=0
  369.  
  370. Forward2:Stop()
  371. script.Parent.Remotes.FlyEffects:FireServer()
  372. elseif key==string.byte("s") or key==18 then
  373. controls.backward=0
  374.  
  375. Forward3:Stop()
  376. script.Parent.Remotes.FlyEffects:FireServer()
  377. elseif key==string.byte("d") or key==19 then
  378. controls.right=0
  379.  
  380. Forward4:Stop()
  381. script.Parent.Remotes.FlyEffects:FireServer()
  382. end
  383. end)
  384. delay(0,function()
  385. fly()
  386. IsFlying = true
  387. end)
  388. end
  389. end)
  390. mouse.KeyDown:connect(function(Key)
  391. if Key == "f" then
  392. if script.Flying.Value == true then
  393. RemoveFlyStuff()
  394. IsFlying = false
  395. plr.Character.Humanoid.PlatformStand = false
  396. end
  397. end
  398. end)
  399.  
  400. while wait() do
  401. if flying == false then
  402. flyanim:Stop()
  403. end
  404. end
  405. end
  406. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement