robloxboblox

Infinite Ammo Squid

May 6th, 2021 (edited)
1,153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.05 KB | None | 0 0
  1. -- Decompiled with the Synapse X Luau decompiler.
  2. game.Players.LocalPlayer.Backpack["Squid Sniper"].LocalScript:Destroy()
  3. script.Parent = game.Players.LocalPlayer.Backpack["Squid Sniper"]
  4. local l__RenderStepped__1 = game:GetService("RunService").RenderStepped;
  5. local l__WeaponDisplay__2 = script.Parent:WaitForChild("WeaponDisplay");
  6. local l__RenderStepped__3 = game:GetService("RunService").RenderStepped;
  7. local l__LocalPlayer__4 = game.Players.LocalPlayer;
  8. local l__mouse__5 = l__LocalPlayer__4:GetMouse();
  9. local l__UserInputService__6 = game:GetService("UserInputService");
  10. local l__LocalPlayer__7 = game:GetService("Players").LocalPlayer;
  11. local l__Head__8 = l__LocalPlayer__7.Character:WaitForChild("Head", false);
  12. local l__mouse__9 = l__LocalPlayer__7:GetMouse();
  13. game:GetService("UserInputService").InputBegan:connect(function(p1)
  14. if p1.KeyCode == Enum.KeyCode.ButtonX then
  15. reload();
  16. return;
  17. end;
  18. if p1.KeyCode == Enum.KeyCode.ButtonL2 then
  19. zoomToggle();
  20. end;
  21. end);
  22. local u1 = false;
  23. local u2 = false;
  24. local u3 = nil;
  25. local u4 = math.huge;
  26. local u5 = {
  27. FieldOfView = nil,
  28. _CFrame = nil,
  29. MouseBehavior = nil,
  30. MouseDeltaSensitivity = nil
  31. };
  32. local l__CurrentCamera__6 = game.Workspace.CurrentCamera;
  33. local u7 = false;
  34. local u8 = nil;
  35. local u9 = nil;
  36. script.Parent.Equipped:connect(function()
  37. u1 = true;
  38. u2 = false;
  39. u3 = l__WeaponDisplay__2:Clone();
  40. u3.Parent = game.Players.LocalPlayer.PlayerGui;
  41. u3.Frame.Ammo.Text = u4 .. " / " .. 5;
  42. game:GetService("ContextActionService"):BindAction("Reload", reload, false, "r");
  43. u3.Frame.ReloadReminder.MouseButton1Click:connect(reload);
  44. u3.Frame.ShootButton.MouseButton1Down:connect(fireWeapon);
  45. u3.Frame.Zoom.MouseButton1Click:connect(zoomToggle);
  46. u5._CFrame = l__CurrentCamera__6.CFrame;
  47. u5.FieldOfView = l__CurrentCamera__6.FieldOfView;
  48. u5.MouseBehavior = l__UserInputService__6.MouseBehavior;
  49. u5.MouseDeltaSensitivity = l__UserInputService__6.MouseDeltaSensitivity;
  50. if l__UserInputService__6.GamepadEnabled then
  51. u3.Frame.ReloadReminder.xboxHint.Visible = true;
  52. u3.Frame.ShootButton.xboxHint.Visible = true;
  53. u3.Frame.Zoom.xboxHint.Visible = true;
  54. end;
  55. if game:GetService("UserInputService").TouchEnabled == true then
  56. u3.Frame.Size = UDim2.new(0.1, 0, 0.1, 0);
  57. u3.Frame.Position = UDim2.new(1, -10, 0.4, 0);
  58. u3.Frame.ShootButton.Visible = true;
  59. u3.MobileAim.Visible = true;
  60. u7 = true;
  61. end;
  62. u8 = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Idle);
  63. u9 = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Shoot);
  64. u8:Play();
  65. end);
  66. script.Parent.ChildRemoved:Connect(function()
  67. print("gun gone");
  68. ResetCamera();
  69. end);
  70. game.Players.LocalPlayer.Character.Humanoid.Died:Connect(function()
  71. print("died");
  72. ResetCamera();
  73. end);
  74. local u10 = false;
  75. local u11 = false;
  76. script.Parent.Unequipped:connect(function()
  77. u2 = false;
  78. u1 = false;
  79. u10 = false;
  80. u11 = false;
  81. ResetCamera();
  82. local l__WeaponDisplay__10 = game.Players.LocalPlayer.PlayerGui:FindFirstChild("WeaponDisplay");
  83. if l__WeaponDisplay__10 then
  84. l__WeaponDisplay__10:Destroy();
  85. end;
  86. game:GetService("ContextActionService"):UnbindAction("Reload");
  87. u8:Stop();
  88. u9:Stop();
  89. end);
  90. game.Players.LocalPlayer.Character.Humanoid.Died:connect(function()
  91. local l__WeaponDisplay__11 = game.Players.LocalPlayer.PlayerGui:FindFirstChild("WeaponDisplay");
  92. if l__WeaponDisplay__11 then
  93. l__WeaponDisplay__11:Destroy();
  94. end;
  95. end);
  96. l__mouse__5.Button1Down:connect(function()
  97. if not u7 then
  98. while wait() do
  99. fireWeapon();
  100. end
  101. end;
  102. end);
  103. local l__Projectiles__12 = game.Workspace.Events.Projectiles;
  104. local u13 = 0;
  105. function fireWeapon()
  106. if u1 then
  107. if not u10 then
  108. if not u11 then
  109. if game:GetService("UserInputService").GamepadEnabled then
  110. u3.Frame.ReloadReminder.xboxHint.Visible = true;
  111. end;
  112. if u4 == 0 then
  113. u3.Frame.ReloadReminder.Visible = true;
  114. return;
  115. end;
  116. u10 = true;
  117. u4 = u4 - 1;
  118. if u4 == 0 then
  119. u3.Frame.ReloadReminder.Visible = true;
  120. end;
  121. u3.Frame.Ammo.Text = u4 .. " / " .. 5;
  122. local v12 = script.Parent.Handle.FireSound:Clone();
  123. v12.Parent = script.Parent.Handle;
  124. v12:Destroy();
  125. game.Workspace.Events.Projectiles.GunSound:FireServer(script.Parent.Handle);
  126. u9:Play();
  127. if l__LocalPlayer__4.Character then
  128. if 0 < l__LocalPlayer__4.Character.Humanoid.Health then
  129. local v13 = l__mouse__5.Hit;
  130. if not u7 then
  131. if game:GetService("UserInputService").GamepadEnabled then
  132. local v14 = u3.MobileAim.AbsolutePosition;
  133. local v15 = u3.MobileAim.AbsoluteSize;
  134. if u2 then
  135. v14 = u3.Scope.AbsolutePosition;
  136. v15 = u3.Scope.AbsoluteSize;
  137. end;
  138. local l__Magnitude__16 = (l__LocalPlayer__4.Character.Head.Position - game.Workspace.CurrentCamera.CFrame.p).Magnitude;
  139. local v17 = game.Workspace.CurrentCamera:ScreenPointToRay(v14.X + v15.X / 2, v14.Y + v15.Y / 2, 0);
  140. local v18, v19 = game.Workspace:FindPartOnRay(Ray.new(v17.Origin, v17.Direction * 10000), l__LocalPlayer__4.Character);
  141. v13 = CFrame.new(v19);
  142. end;
  143. else
  144. v14 = u3.MobileAim.AbsolutePosition;
  145. v15 = u3.MobileAim.AbsoluteSize;
  146. if u2 then
  147. v14 = u3.Scope.AbsolutePosition;
  148. v15 = u3.Scope.AbsoluteSize;
  149. end;
  150. l__Magnitude__16 = (l__LocalPlayer__4.Character.Head.Position - game.Workspace.CurrentCamera.CFrame.p).Magnitude;
  151. v17 = game.Workspace.CurrentCamera:ScreenPointToRay(v14.X + v15.X / 2, v14.Y + v15.Y / 2, 0);
  152. v18, v19 = game.Workspace:FindPartOnRay(Ray.new(v17.Origin, v17.Direction * 10000), l__LocalPlayer__4.Character);
  153. v13 = CFrame.new(v19);
  154. end;
  155. local l__Position__20 = script.Parent.Parent.Head.Position;
  156. local l__lookVector__21 = CFrame.new(l__Position__20, v13.p).lookVector;
  157. l__Projectiles__12.ProjectileRenderEvent:FireServer(0, l__LocalPlayer__4.Name, 1, l__Position__20, v13, 70, 5000, "Squid");
  158. local u14 = 0;
  159. coroutine.wrap(function()
  160. local v22 = game.ReplicatedStorage.ProjectileSquid:Clone();
  161. v22.Parent = game.Workspace;
  162. local v23 = 0;
  163. local v24 = l__Position__20;
  164. local v25 = 2;
  165. while true do
  166. if v23 < 5000 then
  167.  
  168. else
  169. break;
  170. end;
  171. local v26, v27 = game.Workspace:FindPartOnRay(Ray.new(v24, l__lookVector__21.unit * v25), game.Players.LocalPlayer.Character, true, true);
  172. v24 = v27;
  173. if not v26 then
  174.  
  175. else
  176. local l__Body__28 = v26.Parent:FindFirstChild("Body");
  177. if l__Body__28 then
  178. l__Projectiles__12.HealthChange:FireServer(l__Body__28.Parent.OwnerName.Value, 80, u13);
  179. end;
  180. local l__Body__29 = v26.Parent.Parent:FindFirstChild("Body");
  181. if l__Body__29 then
  182. l__Projectiles__12.HealthChange:FireServer(l__Body__29.Parent.OwnerName.Value, 80, u13);
  183. end;
  184. l__Projectiles__12.ProjectileRenderEvent:FireServer(1, l__LocalPlayer__4.Name, 1, l__Position__20, v13, 70, 5000, "Squid", v26, u13);
  185. break;
  186. end;
  187. u14 = u14 + 5;
  188. v22.CFrame = CFrame.new(v24, v24 + l__lookVector__21) * CFrame.Angles(math.pi / 2, u14, 0);
  189. if v25 * 2 < 70 then
  190. v25 = v25 * 2;
  191. elseif v25 ~= 70 then
  192. v25 = 70;
  193. end;
  194. v23 = v23 + v25;
  195. end;
  196. v22:Destroy();
  197. end)();
  198. end;
  199. end;
  200. u10 = false;
  201. u9:Stop();
  202. end;
  203. end;
  204. end;
  205. end;
  206. local u15 = 0;
  207. function reload()
  208. if u11 then
  209. return;
  210. end;
  211. u15 = u15 + 1;
  212. u11 = true;
  213. u10 = false;
  214. script.Parent.Handle.ReloadSound:Play();
  215. if u15 ~= u15 then
  216. print("cancel reload");
  217. return;
  218. end;
  219. u4 = math.huge;
  220. u3.Frame.Ammo.Text = u4 .. " / " .. 5;
  221. u3.Frame.ReloadReminder.Visible = false;
  222. u11 = false;
  223. end;
  224. local u16 = nil;
  225. function ResetCamera()
  226. u16 = nil;
  227. script.Parent.Handle.Transparency = 0;
  228. l__CurrentCamera__6.CameraType = Enum.CameraType.Custom;
  229. l__CurrentCamera__6.CFrame = u5._CFrame;
  230. l__CurrentCamera__6.FieldOfView = u5.FieldOfView;
  231. l__UserInputService__6.MouseBehavior = u5.MouseBehavior;
  232. l__UserInputService__6.MouseDeltaSensitivity = u5.MouseDeltaSensitivity;
  233. if u3:FindFirstChild("Scope") then
  234. u3.Scope.Visible = false;
  235. end;
  236. end;
  237. local u17 = 0;
  238. local u18 = 0;
  239. local u19 = 0;
  240. local u20 = 0;
  241. local function u21()
  242. script.Parent.Handle.Transparency = 1;
  243. l__CurrentCamera__6.CameraType = Enum.CameraType.Scriptable;
  244. u5._CFrame = l__CurrentCamera__6.CFrame;
  245. u5.FieldOfView = l__CurrentCamera__6.FieldOfView;
  246. u5.MouseBehavior = l__UserInputService__6.MouseBehavior;
  247. u5.MouseDeltaSensitivity = l__UserInputService__6.MouseDeltaSensitivity;
  248. u16 = l__mouse__9.Hit.p;
  249. if l__UserInputService__6.TouchEnabled then
  250. local l__AbsolutePosition__30 = u3.MobileAim.AbsolutePosition;
  251. local l__AbsoluteSize__31 = u3.MobileAim.AbsoluteSize;
  252. local l__Magnitude__32 = (l__LocalPlayer__4.Character.Head.Position - game.Workspace.CurrentCamera.CFrame.p).Magnitude;
  253. local v33 = game.Workspace.CurrentCamera:ScreenPointToRay(l__AbsolutePosition__30.X + l__AbsoluteSize__31.X / 2, l__AbsolutePosition__30.Y + l__AbsoluteSize__31.Y / 2, 0);
  254. local v34, v35 = game.Workspace:FindPartOnRay(Ray.new(v33.Origin, v33.Direction * 10000), l__LocalPlayer__4.Character);
  255. u16 = v35;
  256. end;
  257. local v36 = CFrame.new(l__Head__8.Position, u16);
  258. l__CurrentCamera__6.CFrame = v36 + v36.LookVector * 3;
  259. l__CurrentCamera__6.Focus = CFrame.new(u16);
  260. l__CurrentCamera__6.FieldOfView = 8;
  261. l__UserInputService__6.MouseBehavior = Enum.MouseBehavior.LockCenter;
  262. l__UserInputService__6.MouseDeltaSensitivity = 1;
  263. u17 = 0;
  264. u18 = 0;
  265. u19 = 0;
  266. u20 = 0;
  267. u3.Scope.Visible = true;
  268. end;
  269. function zoomToggle()
  270. if u2 then
  271. ResetCamera();
  272. else
  273. u21();
  274. end;
  275. u2 = not u2;
  276. if u2 then
  277. coroutine.wrap(function()
  278. while true do
  279. if u2 then
  280.  
  281. else
  282. break;
  283. end;
  284. moveCamera();
  285. l__RenderStepped__3:wait();
  286. end;
  287. end)();
  288. end;
  289. end;
  290. function getThumbsticks()
  291. local v37 = nil;
  292. local v38 = nil;
  293. local v39 = game:GetService("UserInputService"):GetGamepadState(Enum.UserInputType.Gamepad1);
  294. local v40 = #v39;
  295. local v41 = 1 - 1;
  296. while true do
  297. if v39[v41].KeyCode == Enum.KeyCode.Thumbstick1 then
  298. v37 = v41;
  299. elseif v39[v41].KeyCode == Enum.KeyCode.Thumbstick2 then
  300. v38 = v41;
  301. end;
  302. if 0 <= 1 then
  303. if v41 < v40 then
  304.  
  305. else
  306. break;
  307. end;
  308. elseif v40 < v41 then
  309.  
  310. else
  311. break;
  312. end;
  313. v41 = v41 + 1;
  314. end;
  315. return v37, v38;
  316. end;
  317. function getJoystickPositions()
  318. local v42, v43 = getThumbsticks();
  319. local v44 = l__UserInputService__6:GetGamepadState(Enum.UserInputType.Gamepad1);
  320. return v44[v42].Position, v44[v43].Position;
  321. end;
  322. function moveCamera()
  323. if u2 then
  324. if l__UserInputService__6.GamepadEnabled then
  325. local v45, v46 = getJoystickPositions();
  326. local v47 = Vector2.new(v46.x / 1.6, -v46.y / 1.6) * 0.2;
  327. else
  328. v47 = Vector2.new(0, 0);
  329. end;
  330. local v48 = u18 - v47.y;
  331. local v49 = u20 - v47.x;
  332. if 80 <= v48 then
  333. local v50 = 80;
  334. elseif v48 <= -80 then
  335. v50 = -80;
  336. else
  337. v50 = v48;
  338. end;
  339. u18 = v50;
  340. if 80 <= v49 then
  341. local v51 = 80;
  342. elseif v49 <= -80 then
  343. v51 = -80;
  344. else
  345. v51 = v49;
  346. end;
  347. u20 = v51;
  348. u17 = u17 + (u18 - u17) * 0.35;
  349. u19 = u19 + (u20 - u19) * 0.15;
  350. l__CurrentCamera__6.CFrame = CFrame.new(l__Head__8.Position, u16) * CFrame.Angles(0, math.rad(u19), 0) * CFrame.Angles(math.rad(u17), 0, 0);
  351. l__CurrentCamera__6.CFrame = l__CurrentCamera__6.CFrame + l__CurrentCamera__6.CFrame.LookVector * 3;
  352. end;
  353. end;
  354. local v52 = Vector2.new(0, math.rad(-60));
  355. local function u22(p2)
  356. if u2 then
  357. if l__UserInputService__6.GamepadEnabled then
  358. local v53 = Vector2.new(0, 0);
  359. else
  360. v53 = Vector2.new(p2.Delta.x / 0.8, p2.Delta.y / 0.8) * 0.05;
  361. end;
  362. local v54 = u18 - v53.y;
  363. local v55 = u20 - v53.x;
  364. if v54 >= 80 then
  365. local v56 = 80;
  366. elseif v54 <= -80 then
  367. v56 = -80;
  368. else
  369. v56 = v54;
  370. end;
  371. u18 = v56;
  372. if v55 >= 80 then
  373. local v57 = 80;
  374. elseif v55 <= -80 then
  375. v57 = -80;
  376. else
  377. v57 = v55;
  378. end;
  379. u20 = v57;
  380. u17 = u17 + (u18 - u17) * 0.35;
  381. u19 = u19 + (u20 - u19) * 0.15;
  382. l__CurrentCamera__6.CFrame = CFrame.new(l__Head__8.Position, u16) * CFrame.Angles(0, math.rad(u19), 0) * CFrame.Angles(math.rad(u17), 0, 0);
  383. l__CurrentCamera__6.CFrame = l__CurrentCamera__6.CFrame + l__CurrentCamera__6.CFrame.LookVector * 3;
  384. end;
  385. end;
  386. if not (not l__UserInputService__6.MouseEnabled) or not (not l__UserInputService__6.TouchEnabled) or l__UserInputService__6.GamepadEnabled then
  387. l__UserInputService__6.InputBegan:Connect(function(p3, p4)
  388. if u1 and p3.KeyCode == Enum.KeyCode.Z then
  389. zoomToggle();
  390. end;
  391. end);
  392. l__UserInputService__6.InputChanged:Connect(function(p5, p6)
  393. if u1 and (p5.UserInputType == Enum.UserInputType.MouseMovement or p5.UserInputType == Enum.UserInputType.Touch or p5.UserInputType == Enum.UserInputType.Gamepad1) then
  394. u22(p5);
  395. end;
  396. end);
  397. end;
  398. game.Workspace.Events.S.SEvent.OnClientEvent:connect(function(p7)
  399. u13 = p7;
  400. end);
Add Comment
Please, Sign In to add comment