local function findClosureByNameAndConstants(scriptObject, targetFuncName, upvalueIndex, constantsSignature) for _, func in ipairs(getgc(true)) do if type(func) == "function" and islclosure(func) then local info = debug.getinfo(func) if info.name == targetFuncName and info.source:find(scriptObject.Name) then local constants = debug.getconstants(func) local match = true for i, v in pairs(constantsSignature) do if constants[i] ~= v then match = false break end end if match then return func end end end end end local scriptPath = game:GetService("ReplicatedStorage").Resources.Client.MovementHandler.Stamina local closureName = "DrainStamina" local upvalueIndex = 1 local constantsToMatch = { [1] = 0, [2] = "DrainRateMulti", [3] = "MaxStamina", [4] = "DestroyDrainer", [5] = "BaseRegen", [6] = "tick" } while true do local closure = findClosureByNameAndConstants(scriptPath, closureName, upvalueIndex, constantsToMatch) if closure then debug.setupvalue(closure, upvalueIndex, math.huge) end wait(0.5) end