Team_Alex

Untitled

Mar 13th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.73 KB | None | 0 0
  1. if game.Workspace:FindFirstChild("SevenUFO") ~= nil then
  2. game.Workspace.SevenUFO:Destroy()
  3. end
  4.  
  5. if game.Players.LocalPlayer.Backpack:FindFirstChild("UFOTool") ~= nil then
  6. game.Players.LocalPlayer.Backpack.UFOTool:Destroy()
  7. end
  8.  
  9. local SPAWN_UFO = game:GetObjects('rbxassetid://289807596')[1]
  10. SPAWN_UFO.Parent = game.Workspace
  11. SPAWN_UFO:MoveTo(game.Players.LocalPlayer.Character.Torso.Position)
  12. SPAWN_UFO:MakeJoints()
  13.  
  14. local Flying = false
  15.  
  16. local Player = game.Players.LocalPlayer
  17. local Mouse = Player:GetMouse()
  18.  
  19. local UFO = game.Workspace.SevenUFO
  20. local UFOSeat = game.Workspace.SevenUFO.VehicleSeat
  21.  
  22. local BIN = Instance.new("HopperBin", Player.Backpack)
  23. BIN.Name = "UFOTool"
  24.  
  25. local LeftCannon = UFO.LeftCannon
  26. local RightCannon = UFO.RightCannon
  27.  
  28. game.Workspace.SevenUFO:WaitForChild("VehicleSeat")
  29.  
  30. local Speed = 0
  31. local Keys = {w = false, s = false, a = false, d = false}
  32. local E1
  33. local E2
  34. local function start()
  35. if UFOSeat:FindFirstChild("BodyPosition") ~= nil then
  36. UFOSeat.BodyPosition:Destroy()
  37. end
  38.  
  39. if UFOSeat:FindFirstChild("BodyGyro") ~= nil then
  40. UFOSeat.BodyGyro:Destroy()
  41. end
  42.  
  43. local POS = Instance.new("BodyPosition", UFOSeat)
  44. local GYRO = Instance.new("BodyGyro", UFOSeat)
  45.  
  46. POS.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  47. POS.position = UFOSeat.Position
  48. GYRO.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  49. GYRO.cframe = UFOSeat.CFrame
  50. repeat
  51. wait()
  52. local NEW = GYRO.CFrame - GYRO.CFrame.p + POS.position
  53. if not Keys.w and not Keys.s and not Keys.a and not Keys.d then
  54. Speed = 1
  55. end
  56.  
  57. if Keys.w then
  58. NEW = NEW + game.Workspace.CurrentCamera.CoordinateFrame.lookVector * Speed
  59. Speed = Speed + 0.01
  60. end
  61.  
  62. if Keys.s then
  63. NEW = NEW - game.Workspace.CurrentCamera.CoordinateFrame.lookVector * Speed
  64. Speed = Speed + 0.01
  65. end
  66.  
  67. if Keys.a then
  68. NEW = NEW * CFrame.new(-Speed,0,0)
  69. Speed = Speed + 0.01
  70. end
  71.  
  72. if Keys.d then
  73. NEW = NEW * CFrame.new(Speed,0,0)
  74. Speed = Speed + 0.01
  75. end
  76.  
  77. if Speed > 5 then
  78. Speed = 5
  79. end
  80.  
  81. POS.Position = NEW.p
  82.  
  83. if Keys.w then
  84. GYRO.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad(Speed * 15),0,0)
  85. elseif Keys.s then
  86. GYRO.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(math.rad(Speed * 15),0,0)
  87. else
  88. GYRO.cframe = game.Workspace.CurrentCamera.CoordinateFrame
  89. end
  90.  
  91. until Flying == false
  92.  
  93. if GYRO then
  94. GYRO:Destroy()
  95. end
  96.  
  97. if POS then
  98. POS:Destroy()
  99. end
  100.  
  101. Flying = false
  102. Speed = 0
  103. end
  104.  
  105. E1 = Mouse.KeyDown:connect(function(Key)
  106. if not UFOSeat or not UFOSeat.Parent then
  107. Flying = false
  108. E1:disconnect()
  109. E2:disconnect()
  110. return
  111. end
  112.  
  113. if Key == "w" then
  114. Keys.w = true
  115. elseif Key == "s" then
  116. Keys.s = true
  117. elseif Key == "a" then
  118. Keys.a = true
  119. elseif Key == "d" then
  120. Keys.d = true
  121. elseif Key == "e" then
  122. if Flying == true then
  123. Flying = false
  124. else
  125. Flying = true
  126. start()
  127. end
  128. end
  129. end)
  130.  
  131. E2 = Mouse.KeyUp:connect(function(Key)
  132. if Key == "w" then
  133. Keys.w = false
  134. elseif Key == "s" then
  135. Keys.s = false
  136. elseif Key == "a" then
  137. Keys.a = false
  138. elseif Key == "d" then
  139. Keys.d = false
  140. end
  141. end)
  142.  
  143. start()
  144.  
  145. BIN.Selected:connect(function ()
  146. Mouse.Button1Down:connect(function (Select)
  147.  
  148. local LeftLaser = Instance.new("Part", LeftCannon)
  149. LeftLaser.Name = "LeftLaser"
  150. LeftLaser.FormFactor = "Custom"
  151. LeftLaser.Size = Vector3.new(1,1,1)
  152. local LeftSide = LeftCannon.CFrame
  153.  
  154. local LeftMesh = Instance.new("BlockMesh", LeftLaser)
  155. LeftMesh.Scale = Vector3.new(1,1,(LeftSide.p - Mouse.Hit.p).magnitude)
  156. LeftLaser.CFrame = CFrame.new((LeftSide.p + Mouse.Hit.p)/2, LeftSide.p)
  157. LeftLaser.Color = Color3.new(1,0,0)
  158. LeftLaser.Anchored = true
  159. LeftLaser.CanCollide = false
  160. LeftLaser.Material = "Neon"
  161.  
  162. local RightLaser = Instance.new("Part", RightCannon)
  163. RightLaser.Name = "RightLaser"
  164. RightLaser.FormFactor = "Custom"
  165. RightLaser.Size = Vector3.new(1,1,1)
  166. local LeftSide = LeftCannon.CFrame
  167. local RightSide = RightCannon.CFrame
  168.  
  169. local RightMesh = Instance.new("BlockMesh", RightLaser)
  170. RightMesh.Scale = Vector3.new(1,1,(RightSide.p - Mouse.Hit.p).magnitude)
  171. RightLaser.CFrame = CFrame.new((RightSide.p + Mouse.Hit.p)/2, RightSide.p)
  172. RightLaser.Color = Color3.new(1,0,0)
  173. RightLaser.Anchored = true
  174. RightLaser.CanCollide = false
  175. RightLaser.Material = "Neon"
  176.  
  177. local Explosion = Instance.new("Explosion", game.Workspace)
  178. Explosion.Position = Mouse.Hit.p
  179. Explosion.BlastRadius = 20
  180.  
  181. for i = 1, 10 do
  182. LeftLaser.Transparency = 0.5 + (i * 0.05)
  183. RightLaser.Transparency = 0.5 + (i * 0.05)
  184. wait(0.1)
  185. end
  186.  
  187. LeftLaser:Destroy()
  188. RightLaser:Destroy()
  189. end)
  190. end)
Add Comment
Please, Sign In to add comment