Advertisement
Guest User

Copy

a guest
Mar 20th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.35 KB | None | 0 0
  1. local Version = "0.1"
  2. local UpdateDate = "20 March, 2018"
  3. local UpdateNote = "Cleaned up messy code. Fixes. Added sounds."
  4. print("v" .. Version .. " - " .. UpdateDate .. " - " .. UpdateNote)
  5. local Network = {}
  6. local Stats = {}
  7. local Rocket = {}
  8. local Gui = {}
  9. local Character = {}
  10. local Run = {}
  11. print("[C] Network")
  12. do
  13. local wfc = game.WaitForChild
  14. local Players = game:GetService("Players")
  15. local Player = Players.LocalPlayer
  16. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  17. local Remotes = wfc(ReplicatedStorage, "Remotes")
  18. local RemoteEvent = wfc(Remotes, "RemoteEvent")
  19. local BounceEvent = wfc(Remotes, "BounceEvent")
  20. local RemoteFunction = wfc(Remotes, "RemoteFunction")
  21. local K = {}
  22. local Funcs = {}
  23. local Queue = {}
  24. local function GetKey()
  25. local Key = K.Key * K.A % K.B
  26. K.Key = Key
  27. return Key
  28. end
  29. function Network:add(Name, Func)
  30. Funcs[Name] = Func
  31. if Queue[Name] then
  32. for i = 1, #Queue[Name] do
  33. Func(unpack(Queue[Name][i]))
  34. end
  35. end
  36. end
  37. function Network:send(Name, ...)
  38. RemoteEvent:FireServer(Name, GetKey(), ...)
  39. end
  40. function Network:bounce(Name, ...)
  41. BounceEvent:FireServer(Name, GetKey(), ...)
  42. end
  43. function Network:fetch(Name, ...)
  44. return RemoteFunction:InvokeServer(Name, GetKey(), ...)
  45. end
  46. local function Call(Name, ...)
  47. if Funcs[Name] then
  48. Funcs[Name](...)
  49. else
  50. if not Queue[Name] then
  51. Queue[Name] = {}
  52. end
  53. Queue[Name][#Queue[Name] + 1] = {
  54. ...
  55. }
  56. end
  57. end
  58. BounceEvent.OnClientEvent:Connect(function(Name, ...)
  59. if Funcs[Name] then
  60. return Funcs[Name](...)
  61. else
  62. if not Queue[Name] then
  63. Queue[Name] = {}
  64. end
  65. Queue[Name][#Queue[Name] + 1] = {
  66. ...
  67. }
  68. end
  69. end)
  70. RemoteEvent.OnClientEvent:Connect(Call)
  71. Network:add("K", function(Key)
  72. K = Key
  73. end)
  74. end
  75. print("[C] Stats")
  76. do
  77. local Players = game:GetService("Players")
  78. local Player = Players.LocalPlayer
  79. Network:add("Stats", function(S)
  80. Stats = S
  81. Stats.Fuel = Stats.MaxFuel
  82. Stats.Data = true
  83. end)
  84. repeat
  85. wait()
  86. until Stats.Data
  87. spawn(function()
  88. while wait(30) do
  89. Network:send("Save", Player, {
  90. RegenSpeed = Stats.RegenSpeed,
  91. MaxFuel = Stats.MaxFuel
  92. })
  93. end
  94. end)
  95. end
  96. print("[C] Rocket Tool")
  97. do
  98. local wfc = game.WaitForChild
  99. local Players = game:GetService("Players")
  100. local Player = Players.LocalPlayer
  101. local PlayerGui = wfc(Player, "PlayerGui")
  102. local Sounds = wfc(PlayerGui, "Sounds")
  103. local EmptySound = wfc(Sounds, "Empty")
  104. local Mouse = Player:GetMouse()
  105. local RunService = game:GetService("RunService")
  106. local Debris = game:GetService("Debris")
  107. local Trash = wfc(workspace, "Trash")
  108. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  109. local Resources = wfc(ReplicatedStorage, "Resources")
  110. local FireParticle = wfc(Resources, "Fire")
  111. local RocketSound = wfc(Resources, "Rocket")
  112. local Trail = wfc(Resources, "Trail")
  113. local RSConnection
  114. Rocket.Flying = false
  115. local NoPower = Vector3.new(0, 0, 0)
  116. local VelocityPower = Vector3.new(50000, 50000, 50000)
  117. local GyroPower = Vector3.new(1000000, 1000000, 1000000)
  118. local Cooldown = false
  119. local CooldownTime = 1
  120. function StartEffects(LowerBody, Legs, LeftAtt0, LeftAtt1, RightAtt0, RightAtt1)
  121. local TrailLeft = Trail:Clone()
  122. TrailLeft.Name = "TrailLeft"
  123. TrailLeft.Parent = LowerBody
  124. TrailLeft.Attachment0 = LeftAtt0
  125. TrailLeft.Attachment1 = LeftAtt1
  126. local TrailRight = Trail:Clone()
  127. TrailRight.Name = "TrailRight"
  128. TrailRight.Parent = LowerBody
  129. TrailRight.Attachment0 = RightAtt0
  130. TrailRight.Attachment1 = RightAtt1
  131. local Rocket = RocketSound:Clone()
  132. Rocket.Parent = LowerBody
  133. Rocket:Play()
  134. local Fire = FireParticle:Clone()
  135. Fire.Parent = LowerBody
  136. Fire.Enabled = true
  137. for i = 1, #Legs do
  138. Legs[i].Transparency = 1
  139. do
  140. local BodyPart = Legs[i]:Clone()
  141. BodyPart:ClearAllChildren()
  142. BodyPart.Transparency = 0
  143. BodyPart.CanCollide = true
  144. BodyPart.CFrame = Legs[i].CFrame
  145. BodyPart.Parent = Trash
  146. Debris:AddItem(BodyPart, 1.5)
  147. spawn(function()
  148. for j = 0, 1, 0.1 do
  149. BodyPart.Transparency = j
  150. wait()
  151. end
  152. end)
  153. end
  154. end
  155. end
  156. function StopEffects(LowerBody, Legs)
  157. local TrailLeft, TrailRight = LowerBody:FindFirstChild("TrailLeft"), LowerBody:FindFirstChild("TrailRight")
  158. if TrailLeft then
  159. TrailLeft:Destroy()
  160. end
  161. if TrailRight then
  162. TrailRight:Destroy()
  163. end
  164. local Fire = LowerBody:FindFirstChild("Fire")
  165. if Fire then
  166. Fire:Destroy()
  167. end
  168. local Rocket = LowerBody:FindFirstChild("Rocket")
  169. if Rocket then
  170. Rocket:Stop()
  171. Rocket:Destroy()
  172. end
  173. for i = 1, #Legs do
  174. Legs[i].Transparency = 0
  175. end
  176. end
  177. Network:add("StartEffects", function(LowerBody, Legs, LeftAtt0, LeftAtt1, RightAtt0, RightAtt1)
  178. StartEffects(LowerBody, Legs, LeftAtt0, LeftAtt1, RightAtt0, RightAtt1)
  179. end)
  180. Network:add("StopEffects", function(LowerBody, Legs, LeftAtt0, LeftAtt1, RightAtt0, RightAtt1)
  181. StopEffects(LowerBody, Legs, LeftAtt0, LeftAtt1, RightAtt0, RightAtt1)
  182. end)
  183. function Rocket:Regen()
  184. repeat
  185. Stats.Fuel = Stats.Fuel + Stats.RegenSpeed
  186. wait(0.01)
  187. until RSConnection or Stats.Fuel >= Stats.MaxFuel
  188. if Stats.Fuel > Stats.MaxFuel then
  189. Stats.Fuel = Stats.MaxFuel
  190. end
  191. end
  192. local function Deactivate()
  193. if RSConnection then
  194. RSConnection:Disconnect()
  195. RSConnection = nil
  196. Network:send("Flying", Player, false)
  197. Rocket.Flying = false
  198. Character.Hits = {}
  199. spawn(function()
  200. Rocket:Regen()
  201. end)
  202. Character.Gyro.MaxTorque = NoPower
  203. Character.Vel.Velocity = NoPower
  204. Character.Vel.MaxForce = NoPower
  205. Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
  206. Network:bounce("StopEffects", Character.LowerTorso, Character.Legs, Character.LowerTorso, Character.Legs, Character.LeftAtt0, Character.LeftAtt1, Character.RightAtt0, Character.RightAtt1)
  207. StopEffects(Character.LowerTorso, Character.Legs, Character.LeftAtt0, Character.LeftAtt1, Character.RightAtt0, Character.RightAtt1)
  208. wait(CooldownTime)
  209. Cooldown = false
  210. end
  211. end
  212. function Activate()
  213. if not Cooldown and Character.Humanoid.Health > 0 and 0 < Stats.Fuel then
  214. Cooldown = true
  215. x = 0
  216. Network:send("Flying", Player, true)
  217. Rocket.Flying = true
  218. Network:bounce("StartEffects", Character.LowerTorso, Character.Legs, Character.LeftAtt0, Character.LeftAtt1, Character.RightAtt0, Character.RightAtt1)
  219. StartEffects(Character.LowerTorso, Character.Legs, Character.LeftAtt0, Character.LeftAtt1, Character.RightAtt0, Character.RightAtt1)
  220. Character.Gyro.MaxTorque = GyroPower
  221. Character.Vel.MaxForce = VelocityPower
  222. RSConnection = RunService.RenderStepped:Connect(function(dt)
  223. x = (x + dt * 1.5) % 1
  224. Stats.Fuel = Stats.Fuel - 0.5
  225. if Stats.Fuel <= 0 then
  226. Stats.Fuel = 0
  227. EmptySound:Play()
  228. Deactivate()
  229. return
  230. end
  231. local MouseCF = Mouse.Hit
  232. local Direction = MouseCF.p - Character.RootPart.CFrame.p
  233. Character.Gyro.CFrame = CFrame.new(Character.RootPart.CFrame.p, Character.RootPart.CFrame.p + Direction) * CFrame.Angles(-math.pi / 2, math.rad(x * 360), 0)
  234. Character.Vel.Velocity = Direction.unit * 100
  235. if Character.Humanoid:GetState() ~= Enum.HumanoidStateType.FallingDown then
  236. Character.Humanoid:ChangeState(Enum.HumanoidStateType.FallingDown)
  237. end
  238. end)
  239. end
  240. end
  241. function Rocket:Setup()
  242. local Tool = Instance.new("Tool")
  243. Tool.Name = "Rocket"
  244. Tool.CanBeDropped = false
  245. Tool.RequiresHandle = false
  246. Tool.TextureId = "rbxassetid://1526120813"
  247. Tool.Parent = Character.Backpack
  248. Tool.Activated:Connect(Activate)
  249. Tool.Deactivated:Connect(Deactivate)
  250. Tool.Unequipped:Connect(Deactivate)
  251. end
  252. end
  253. print("[C] Input")
  254. do
  255. local Players = game:GetService("Players")
  256. local Player = Players.LocalPlayer
  257. local UserInputService = game:GetService("UserInputService")
  258. local Cooldown = false
  259. local CooldownTime = 2
  260. UserInputService.InputBegan:Connect(function(Input, GPE)
  261. if GPE then
  262. return
  263. end
  264. if Input.UserInputType == Enum.UserInputType.MouseButton1 and not Cooldown then
  265. Cooldown = true
  266. Stats.MaxFuel = Stats.MaxFuel + 1
  267. Network:send("Update", Player, Stats.MaxFuel)
  268. Rocket:Regen()
  269. wait(CooldownTime)
  270. Cooldown = false
  271. end
  272. end)
  273. end
  274. print("[C] Gui")
  275. do
  276. local wfc = game.WaitForChild
  277. local ud2 = UDim2.new
  278. local Players = game:GetService("Players")
  279. local Player = Players.LocalPlayer
  280. local PlayerGui = wfc(Player, "PlayerGui")
  281. local FuelGui = wfc(PlayerGui, "Fuel")
  282. local FuelFrame = wfc(FuelGui, "Frame")
  283. local FuelBG = wfc(FuelFrame, "Fuelbar")
  284. local Fuelbar = wfc(FuelBG, "Bar")
  285. local FuelAmount = wfc(FuelFrame, "Amount")
  286. function Gui.HStep()
  287. Fuelbar:TweenSize(ud2(Stats.Fuel / Stats.MaxFuel, 0, 1, 0), "Out", "Sine", 0.1, true)
  288. FuelAmount.Text = "[" .. math.floor(Stats.Fuel) .. "/" .. Stats.MaxFuel .. "]"
  289. end
  290. end
  291. print("[C] Character")
  292. do
  293. local wfc = game.WaitForChild
  294. local Players = game:GetService("Players")
  295. local Player = Players.LocalPlayer
  296. local function GetCharacter()
  297. repeat
  298. wait()
  299. until Player.Character and Player.Character.Parent
  300. local Char = Player.Character
  301. Character.C = Char
  302. Character.Backpack = wfc(Player, "Backpack")
  303. Character.Head = wfc(Char, "Head")
  304. Character.RootPart = wfc(Char, "HumanoidRootPart")
  305. Character.Humanoid = wfc(Char, "Humanoid")
  306. Character.LowerTorso = wfc(Char, "LowerTorso")
  307. Character.LeftUpperArm = wfc(Char, "LeftUpperArm")
  308. Character.RightUpperArm = wfc(Char, "RightUpperArm")
  309. Character.Legs = {
  310. wfc(Char, "LeftFoot"),
  311. wfc(Char, "LeftLowerLeg"),
  312. wfc(Char, "LeftUpperLeg"),
  313. wfc(Char, "RightFoot"),
  314. wfc(Char, "RightLowerLeg"),
  315. wfc(Char, "RightUpperLeg")
  316. }
  317. Character.LeftAtt0 = wfc(Character.LeftUpperArm, "LeftShoulderAttachment")
  318. Character.LeftAtt1 = wfc(Character.LeftUpperArm, "LeftElbowRigAttachment")
  319. Character.RightAtt0 = wfc(Character.RightUpperArm, "RightShoulderAttachment")
  320. Character.RightAtt1 = wfc(Character.RightUpperArm, "RightElbowRigAttachment")
  321. local Gyro = Instance.new("BodyGyro")
  322. Gyro.Name = "DirectionForce"
  323. Gyro.P = 10000
  324. Gyro.MaxTorque = Vector3.new(0, 0, 0)
  325. Gyro.Parent = Character.RootPart
  326. Character.Gyro = Gyro
  327. local Velocity = Instance.new("BodyVelocity")
  328. Velocity.Name = "FlyForce"
  329. Velocity.MaxForce = Vector3.new(0, 0, 0)
  330. Velocity.Parent = Character.RootPart
  331. Character.Vel = Velocity
  332. Rocket:Setup()
  333. Character.Hits = {}
  334. Character.Humanoid.Touched:Connect(function(Hit)
  335. if Hit and Hit.Parent and Hit.Parent:FindFirstChild("Head") and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent.Humanoid.Health > 0 and Players:GetPlayerFromCharacter(Hit.Parent) and Rocket.Flying and not Character.Hits[Hit.Parent] then
  336. Character.Hits[Hit.Parent] = true
  337. Network:send("Damage", Player, Character.Humanoid, Players:GetPlayerFromCharacter(Hit.Parent), Hit.Parent.Humanoid, Hit.Parent.Head)
  338. end
  339. end)
  340. end
  341. GetCharacter()
  342. Player.CharacterAdded:Connect(GetCharacter)
  343. end
  344. print("[C] Run")
  345. do
  346. local RunService = game:GetService("RunService")
  347. local RenderStepped = RunService.RenderStepped
  348. local Heartbeat = RunService.Heartbeat
  349. local RSLoop = {}
  350. local HBLoop = {
  351. Gui.HStep
  352. }
  353. RenderStepped:Connect(function()
  354. for i = 1, #RSLoop do
  355. RSLoop[i]()
  356. end
  357. end)
  358. Heartbeat:Connect(function()
  359. for i = 1, #HBLoop do
  360. HBLoop[i]()
  361. end
  362. end)
  363. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement