NoTextForSpeech

autoshoot

Feb 21st, 2026 (edited)
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. local RS = cloneref(game:GetService("ReplicatedStorage"))
  2. local GameReq = getrenv().require
  3. local RunService = cloneref(game:GetService("RunService"))
  4. local UIS = cloneref(game:GetService("UserInputService"))
  5.  
  6. local WC = GameReq(RS.common.ZS_Framework.Modules.Controllers.WeaponController)
  7. local AS = GameReq(RS.common.ZS_Framework.Modules.Controllers.WeaponController.WeaponControllerUtils.AutoShoot)
  8.  
  9. local Players = game:GetService("Players")
  10. local Player = game:GetService("Players").LocalPlayer
  11. local ZombiesFolder = workspace:FindFirstChild("Zombies")
  12.  
  13. if #Players:GetPlayers() ~= 1 then return end
  14.  
  15. local IsMouseButtonPressed = UIS.IsMouseButtonPressed
  16. local GetCurrentWeapon = WC.GetCurrentWeapon
  17. local MB1 = Enum.UserInputType.MouseButton1
  18. local Heartbeat = RunService.Heartbeat
  19. local os_clock = os.clock
  20.  
  21. local MyPenetration = 1
  22. local Timeout = 0
  23. local WaitStart = 0
  24.  
  25. WC:SetInputMethod("Keyboard")
  26.  
  27. local function GetZombieCount()
  28. if not ZombiesFolder or not ZombiesFolder.Parent then
  29. ZombiesFolder = workspace:FindFirstChild("Zombies")
  30. end
  31. if not ZombiesFolder then return 0 end
  32.  
  33. local c = 0
  34. local children = ZombiesFolder:GetChildren()
  35. for i = 1, #children do
  36. local z = children[i]
  37. local hp = z:GetAttribute("Health")
  38. if not hp or hp > 0 then
  39. c = c + 1
  40. end
  41. end
  42. return c
  43. end
  44.  
  45. AS.CheckTarget = function()
  46. return GetZombieCount() > 0
  47. end
  48.  
  49. Heartbeat:Connect(function()
  50. local weapon = GetCurrentWeapon(WC)
  51. if weapon and weapon.Config and not weapon.Config.IsMelee then
  52. local count = GetZombieCount()
  53. local fireNow = false
  54.  
  55. if count >= MyPenetration then
  56. fireNow = true
  57. WaitStart = 0
  58. elseif count > 0 then
  59. if WaitStart == 0 then
  60. WaitStart = os_clock()
  61. end
  62. if os_clock() - WaitStart >= Timeout then
  63. fireNow = true
  64. end
  65. else
  66. WaitStart = 0
  67. end
  68.  
  69. if weapon.Ammo > 0 and not weapon.Reloading and fireNow then
  70. WC.PrimaryAttackDown = true
  71. weapon.MouseReleased = true
  72. if count >= MyPenetration or os_clock() - WaitStart >= Timeout then
  73. WaitStart = 0
  74. end
  75. elseif not IsMouseButtonPressed(UIS, MB1) then
  76. WC.PrimaryAttackDown = false
  77. end
  78. else
  79. WaitStart = 0
  80. if not IsMouseButtonPressed(UIS, MB1) then
  81. WC.PrimaryAttackDown = false
  82. end
  83. end
  84. end)
  85. warn("AUTO SHOOT LOADED SUCCESFULLY")
Advertisement
Add Comment
Please, Sign In to add comment