Advertisement
trixade

Untitled

Oct 2nd, 2021
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.67 KB | None | 0 0
  1.  function AvoidCrasher(Fenv, F)
  2.    for i, v in pairs(Fenv) do
  3.        if i == "script" and typeof(v) == "Instance" and v.ClassName == F.ClassName and F == v then
  4.            return true
  5.        end
  6.    end
  7.    return false
  8. end
  9. function LoopThroughTable(Tab, F, LookThrough)
  10.    for i, v in pairs(LookThrough) do
  11.        if typeof(v) == "function" and islclosure(v) and getfenv(v) and AvoidCrasher(getfenv(v), F) then
  12.            table.insert(Tab, v)
  13.        end
  14.    end
  15. end
  16. function GetFunctionsFromScript(F)
  17.    local functionstab = {}
  18.    LoopThroughTable(functionstab, F, getgc())
  19.    LoopThroughTable(functionstab, F, debug.getregistry())
  20.    return functionstab
  21. end
  22. function ChangeAmmoGun(Gun)
  23.    if not Gun:FindFirstChild("TriggerScript") then return end
  24.    local T = GetFunctionsFromScript(Gun.TriggerScript)
  25.    for i, v in pairs(GetFunctionsFromScript(Gun.TriggerScript)) do
  26.        if table.find(debug.getconstants(v), "Reloading...") then
  27.            if typeof(debug.getupvalue(v, 3)) ~= "number" then
  28.                debug.setupvalue(v, 4, 99999999)
  29.            else
  30.                hookfunction(v, function() end)
  31.            end
  32.        elseif table.find(debug.getconstants(T[i]), "Ray") then
  33.            debug.setconstant(T[i], 9, 999999999)
  34.        end
  35.    end
  36. end
  37. for i, v in pairs(game.Players.LocalPlayer.Backpack:GetChildren()) do
  38.    ChangeAmmoGun(v)
  39. end
  40. game.Players.LocalPlayer.CharacterAdded:connect(function()
  41.    repeat
  42.        wait()
  43.    until game.Players.LocalPlayer:FindFirstChild("Backpack") and #game.Players.LocalPlayer.Backpack:GetChildren() > 0
  44.    for i, v in pairs(game.Players.LocalPlayer.Backpack:GetChildren()) do
  45.        ChangeAmmoGun(v)
  46.    end
  47. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement