robloxboblox

Infinite Ammo Harpoon

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