NoTextForSpeech

autorefillammo

Feb 23rd, 2026 (edited)
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. local ReplicatedStorage = cloneref(game:GetService("ReplicatedStorage"))
  2. local Players = cloneref(game:GetService("Players"))
  3. local LocalPlayer = Players.LocalPlayer
  4.  
  5. local WeaponController = require(ReplicatedStorage.common.ZS_Framework.Modules.Controllers.WeaponController)
  6. local PromptModule = require(ReplicatedStorage.common.ProximityPromptZS)
  7.  
  8. local PromptTable = nil
  9. local Upvalues = debug.getupvalues(PromptModule.GetPromptByIdentifier)
  10. for Index = 1, #Upvalues do
  11. local Value = Upvalues[Index]
  12. if type(Value) == "table" and next(Value) then
  13. local _, FirstEntry = next(Value)
  14. if type(FirstEntry) == "table" and FirstEntry.Triggered then
  15. PromptTable = Value
  16. break
  17. end
  18. end
  19. end
  20.  
  21. local StringUpper = string.upper
  22. local StringFind = string.find
  23. local GetCurrentWeapon = WeaponController.GetCurrentWeapon
  24.  
  25. task.spawn(function()
  26. while task.wait(0.5) do
  27. local CurrentWeapon = GetCurrentWeapon(WeaponController)
  28. if CurrentWeapon and CurrentWeapon.Config and not CurrentWeapon.Config.IsMelee and CurrentWeapon.StoredAmmo == 0 then
  29. if PromptTable then
  30. for _, Prompt in pairs(PromptTable) do
  31. local Properties = Prompt.Properties
  32. if Properties and Properties.Enabled ~= false then
  33. local ActionText = Properties.ActionText
  34. if ActionText and StringFind(StringUpper(ActionText), "REFILL") then
  35. Prompt.Triggered:Fire(LocalPlayer)
  36. end
  37. end
  38. end
  39. end
  40. end
  41. end
  42. end)
  43.  
  44. warn("AUTO REFILL AMMO LOADED")
Advertisement
Add Comment
Please, Sign In to add comment