Advertisement
robloxboblox

Infinite Ammo Rocket

May 6th, 2021
1,731
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.40 KB | None | 0 0
  1. -- Decompiled with the Synapse X Luau decompiler.
  2. game.Players.LocalPlayer.Backpack.Rocket.LocalScript:Destroy()
  3. script.Parent = game.Players.LocalPlayer.Backpack.Rocket
  4. local l__RenderStepped__1 = game:GetService("RunService").RenderStepped;
  5. local l__LocalPlayer__2 = game.Players.LocalPlayer;
  6. local l__mouse__3 = l__LocalPlayer__2:GetMouse();
  7. local u1 = false;
  8. local u2 = nil;
  9. local l__WeaponDisplay__3 = script.Parent:WaitForChild("WeaponDisplay");
  10. local u4 = math.huge;
  11. local u5 = false;
  12. local u6 = nil;
  13. local u7 = nil;
  14. script.Parent.Equipped:connect(function()
  15. u1 = true;
  16. u2 = l__WeaponDisplay__3:Clone();
  17. u2.Parent = game.Players.LocalPlayer.PlayerGui;
  18. u2.Frame.Ammo.Text = u4 .. " / " .. 2;
  19. game:GetService("ContextActionService"):BindAction("Reload", reload, false, "r");
  20. game:GetService("UserInputService").InputBegan:connect(function(p1)
  21. if p1.KeyCode == Enum.KeyCode.ButtonX then
  22. reload();
  23. end;
  24. end);
  25. u2.Frame.ReloadReminder.MouseButton1Click:connect(reload);
  26. u2.Frame.ShootButton.MouseButton1Down:connect(fireWeapon);
  27. u2.Frame.ShootButton.MouseButton1Up:connect(stopFiring);
  28. if game:GetService("UserInputService").GamepadEnabled then
  29. u2.Frame.ReloadReminder.xboxHint.Visible = true;
  30. u2.Frame.ShootButton.xboxHint.Visible = true;
  31. end;
  32. if game:GetService("UserInputService").TouchEnabled == true then
  33. u2.Frame.Size = UDim2.new(0.1, 0, 0.1, 0);
  34. u2.Frame.Position = UDim2.new(1, -10, 0.4, 0);
  35. u2.Frame.ShootButton.Visible = true;
  36. u2.MobileAim.Visible = true;
  37. u5 = true;
  38. end;
  39. u6 = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Idle);
  40. u7 = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Shoot);
  41. u6:Play();
  42. end);
  43. local u8 = false;
  44. local u9 = false;
  45. script.Parent.Unequipped:connect(function()
  46. u1 = false;
  47. u8 = false;
  48. u9 = false;
  49. local l__WeaponDisplay__4 = game.Players.LocalPlayer.PlayerGui:FindFirstChild("WeaponDisplay");
  50. if l__WeaponDisplay__4 then
  51. l__WeaponDisplay__4:Destroy();
  52. end;
  53. u6:Stop();
  54. u7:Stop();
  55. game:GetService("ContextActionService"):UnbindAction("Reload");
  56. end);
  57. game.Players.LocalPlayer.Character.Humanoid.Died:connect(function()
  58. local l__WeaponDisplay__5 = game.Players.LocalPlayer.PlayerGui:FindFirstChild("WeaponDisplay");
  59. if l__WeaponDisplay__5 then
  60. l__WeaponDisplay__5:Destroy();
  61. end;
  62. end);
  63. l__mouse__3.Button1Down:connect(function()
  64. if not u5 then
  65. while Wait() do
  66. fireWeapon();
  67. end
  68. end;
  69. end);
  70. local l__Projectiles__10 = game.Workspace.Events.Projectiles;
  71. local u11 = 0;
  72. function fireWeapon()
  73. if u1 then
  74. if not u8 then
  75. if not u9 then
  76. if game:GetService("UserInputService").GamepadEnabled then
  77. u2.Frame.ReloadReminder.xboxHint.Visible = true;
  78. end;
  79. if u4 == 0 then
  80. u2.Frame.ReloadReminder.Visible = true;
  81. return;
  82. end;
  83. u8 = true;
  84. u4 = u4 - 1;
  85. u2.Frame.Ammo.Text = u4 .. " / " .. 2;
  86. if u4 == 0 then
  87. u2.Frame.ReloadReminder.Visible = true;
  88. end;
  89. local v6 = script.Parent.Handle.FireSound:Clone();
  90. v6.Parent = script.Parent.Handle;
  91. v6:Destroy();
  92. game.Workspace.Events.Projectiles.GunSound:FireServer(script.Parent.Handle);
  93. u7:Play();
  94. if l__LocalPlayer__2.Character then
  95. if 0 < l__LocalPlayer__2.Character.Humanoid.Health then
  96. local v7 = l__mouse__3.Hit;
  97. if u5 then
  98. local l__AbsolutePosition__8 = u2.MobileAim.AbsolutePosition;
  99. local l__AbsoluteSize__9 = u2.MobileAim.AbsoluteSize;
  100. local l__Magnitude__10 = (l__LocalPlayer__2.Character.Head.Position - game.Workspace.CurrentCamera.CFrame.p).Magnitude;
  101. local v11 = game.Workspace.CurrentCamera:ScreenPointToRay(l__AbsolutePosition__8.X + l__AbsoluteSize__9.X / 2, l__AbsolutePosition__8.Y + l__AbsoluteSize__9.Y / 2, 0);
  102. local v12, v13 = game.Workspace:FindPartOnRay(Ray.new(v11.Origin, v11.Direction * 10000), l__LocalPlayer__2.Character);
  103. v7 = CFrame.new(v13);
  104. end;
  105. local l__Position__14 = script.Parent.Handle.Position;
  106. local l__lookVector__15 = CFrame.new(l__Position__14, v7.p).lookVector;
  107. l__Projectiles__10.ProjectileRenderEvent:FireServer(0, l__LocalPlayer__2.Name, 1, l__Position__14, v7, 5, 1000, "Rocket");
  108. coroutine.wrap(function()
  109. local v16 = game.ReplicatedStorage.ProjectileRocket:Clone();
  110. v16.Parent = game.Workspace;
  111. local v17 = 0;
  112. local v18 = l__Position__14;
  113. local v19 = 2;
  114. while true do
  115. if v17 < 1000 then
  116.  
  117. else
  118. break;
  119. end;
  120. local v20, v21 = game.Workspace:FindPartOnRay(Ray.new(v18, l__lookVector__15.unit * v19), game.Players.LocalPlayer.Character, true, true);
  121. v18 = v21;
  122. if not v20 then
  123.  
  124. else
  125. local l__Body__22 = v20.Parent:FindFirstChild("Body");
  126. if l__Body__22 then
  127. l__Projectiles__10.HealthChange:FireServer(l__Body__22.Parent.OwnerName.Value, 100, u11);
  128. end;
  129. local l__Body__23 = v20.Parent.Parent:FindFirstChild("Body");
  130. if l__Body__23 then
  131. l__Projectiles__10.HealthChange:FireServer(l__Body__23.Parent.OwnerName.Value, 100, u11);
  132. end;
  133. local v24 = Instance.new("Explosion");
  134. v24.ExplosionType = Enum.ExplosionType.NoCraters;
  135. v24.Position = v21;
  136. v24.DestroyJointRadiusPercent = 0;
  137. v24.Parent = game.Workspace;
  138. l__Projectiles__10.ProjectileRenderEvent:FireServer(1, l__LocalPlayer__2.Name, 1, l__Position__14, v21, 5, 1000, "Rocket", v20, u11);
  139. break;
  140. end;
  141. v16.CFrame = CFrame.new(v18, v18 + l__lookVector__15);
  142. if v19 * 2 < 5 then
  143. v19 = v19 * 2;
  144. elseif v19 ~= 5 then
  145. v19 = 5;
  146. end;
  147. v17 = v17 + v19;
  148. l__RenderStepped__1:wait();
  149. end;
  150. v16:Destroy();
  151. end)();
  152. end;
  153. end;
  154. u8 = false;
  155. u7:Stop();
  156. end;
  157. end;
  158. end;
  159. end;
  160. function stopFiring()
  161. if u1 then
  162. u8 = false;
  163. end;
  164. end;
  165. l__mouse__3.Button1Up:connect(function()
  166. stopFiring();
  167. end);
  168. local u12 = 0;
  169. function reload()
  170. if u9 then
  171. return;
  172. end;
  173. u12 = u12 + 1;
  174. u9 = true;
  175. u8 = false;
  176. script.Parent.Handle.ReloadSound:Play();
  177.  
  178. if u12 ~= u12 then
  179. print("cancel reload");
  180. return;
  181. end;
  182. u4 = math.huge;
  183. u2.Frame.Ammo.Text = u4 .. " / " .. 2;
  184. u2.Frame.ReloadReminder.Visible = false;
  185. u9 = false;
  186. end;
  187. game.Workspace.Events.S.SEvent.OnClientEvent:connect(function(p2)
  188. u11 = p2;
  189. end);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement