Advertisement
robloxboblox

Infinite Ammo Shotgun

May 6th, 2021
910
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.46 KB | None | 0 0
  1. -- Decompiled with the Synapse X Luau decompiler.
  2. game.Players.LocalPlayer.Backpack.Shotgun.LocalScript:Destroy()
  3. script.Parent = game.Players.LocalPlayer.Backpack.Shotgun
  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 .. " / " .. 4;
  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. if game:GetService("UserInputService").GamepadEnabled then
  28. u2.Frame.ReloadReminder.xboxHint.Visible = true;
  29. u2.Frame.ShootButton.xboxHint.Visible = true;
  30. end;
  31. if game:GetService("UserInputService").TouchEnabled == true then
  32. u2.Frame.Size = UDim2.new(0.1, 0, 0.1, 0);
  33. u2.Frame.Position = UDim2.new(1, -10, 0.4, 0);
  34. u2.Frame.ShootButton.Visible = true;
  35. u2.MobileAim.Visible = true;
  36. u5 = true;
  37. end;
  38. u6 = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Idle);
  39. u7 = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Shoot);
  40. u6:Play();
  41. end);
  42. local u8 = false;
  43. local u9 = false;
  44. script.Parent.Unequipped:connect(function()
  45. u1 = false;
  46. u8 = false;
  47. u9 = false;
  48. local l__WeaponDisplay__4 = game.Players.LocalPlayer.PlayerGui:FindFirstChild("WeaponDisplay");
  49. if l__WeaponDisplay__4 then
  50. l__WeaponDisplay__4:Destroy();
  51. end;
  52. u6:Stop();
  53. u7:Stop();
  54. game:GetService("ContextActionService"):UnbindAction("Reload");
  55. end);
  56. game.Players.LocalPlayer.Character.Humanoid.Died:connect(function()
  57. local l__WeaponDisplay__5 = game.Players.LocalPlayer.PlayerGui:FindFirstChild("WeaponDisplay");
  58. if l__WeaponDisplay__5 then
  59. l__WeaponDisplay__5:Destroy();
  60. end;
  61. end);
  62. l__mouse__3.Button1Down:connect(function()
  63. if not u5 then
  64. while wait() do
  65. fireWeapon();
  66. end
  67. end;
  68. end);
  69. local u10 = 0;
  70. local l__Projectiles__11 = game.Workspace.Events.Projectiles;
  71. local u12 = 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. if u4 == 0 then
  86. u2.Frame.ReloadReminder.Visible = true;
  87. end;
  88. u2.Frame.Ammo.Text = u4 .. " / " .. 4;
  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__13 = script.Parent.Handle.Position;
  106. local function v14()
  107. u10 = u10 + 1;
  108. local v15 = CFrame.new(l__Position__13, v7.p).lookVector + Vector3.new(math.random(-50, 50) / 1000, math.random(-50, 50) / 1000, math.random(-50, 50) / 1000);
  109. l__Projectiles__11.ProjectileRenderEvent:FireServer(0, l__LocalPlayer__2.Name, u10, l__Position__13, v7, 20, 500, "Shotgun");
  110. local v16 = game.ReplicatedStorage.ProjectileShotgun:Clone();
  111. v16.Parent = game.Workspace;
  112. local v17 = 0;
  113. local v18 = 2;
  114. while true do
  115. if v17 < 500 then
  116.  
  117. else
  118. break;
  119. end;
  120. local v19, v20 = game.Workspace:FindPartOnRay(Ray.new(l__Position__13, v15.unit * v18), game.Players.LocalPlayer.Character, true, true);
  121. if not v19 then
  122. v16.CFrame = CFrame.new(v20, v20 + v15);
  123. else
  124. if v19.Name ~= "ProjectileShotgun" then
  125. local l__Body__21 = v19.Parent:FindFirstChild("Body");
  126. if l__Body__21 then
  127. l__Projectiles__11.HealthChange:FireServer(l__Body__21.Parent.OwnerName.Value, 9, u12);
  128. end;
  129. local l__Body__22 = v19.Parent.Parent:FindFirstChild("Body");
  130. if l__Body__22 then
  131. l__Projectiles__11.HealthChange:FireServer(l__Body__22.Parent.OwnerName.Value, 9, u12);
  132. end;
  133. l__Projectiles__11.ProjectileRenderEvent:FireServer(1, l__LocalPlayer__2.Name, u10, l__Position__13, v7, 20, 500, "Shotgun", v19, u12);
  134. break;
  135. end;
  136. v16.CFrame = CFrame.new(v20, v20 + v15);
  137. end;
  138. if v18 * 2 < 20 then
  139. v18 = v18 * 2;
  140. elseif v18 ~= 20 then
  141. v18 = 20;
  142. end;
  143. v17 = v17 + v18;
  144. l__RenderStepped__1:wait();
  145. end;
  146. v16:Destroy();
  147. end;
  148. local v23 = 1 - 1;
  149. while true do
  150. coroutine.wrap(v14)();
  151. if 0 <= 1 then
  152. if v23 < 5 then
  153.  
  154. else
  155. break;
  156. end;
  157. elseif 5 < v23 then
  158.  
  159. else
  160. break;
  161. end;
  162. v23 = v23 + 1;
  163. end;
  164. end;
  165. end;
  166. u8 = false;
  167. u7:Stop();
  168. end;
  169. end;
  170. end;
  171. end;
  172. local u14 = 0;
  173. function reload()
  174. if u9 then
  175. return;
  176. end;
  177. u10 = 0;
  178. u14 = u14 + 1;
  179. u9 = true;
  180. u8 = false;
  181. script.Parent.Handle.ReloadSound:Play();
  182. if u14 ~= u14 then
  183. print("cancel reload");
  184. return;
  185. end;
  186. u4 = math.huge;
  187. u2.Frame.Ammo.Text = u4 .. " / " .. 4;
  188. u2.Frame.ReloadReminder.Visible = false;
  189. u9 = false;
  190. end;
  191. game.Workspace.Events.S.SEvent.OnClientEvent:connect(function(p2)
  192. u12 = p2;
  193. end);
  194.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement