Do you have to set arguments to nil after using fireserver or invokeserver? will they cause a memory leak if they are not set to nil or will they get automatically garbage collected.
If you nil the variable the function is assigned to then that will do the trick. On which end do you intend to nil the arguments?
Would this be fine? If I didn’t nil these variables would it cause memory leaks?
Events.SkillPoint.OnServerInvoke = function(Player, Request, FindAmount)
local FindRealAmount = math.floor(FindAmount)
if Request == “powerincrease” then
end
Request = nil
FindAmount = nil
end
local function skillPoint(Player, Request, FindAmount)
local FindRealAmount = math.floor(FindAmount)
if Request == "powerincrease" then
end
end
Events.SkillPoint.OnServerInvoke = skillPoint()
skillPoint = nil
I’d assume 2 variables would essentially be negligible but it depends on how often the server is being invoked & thus how often those variables are being created.
It’s being invoked frequently with different things would the server not hold onto these variables if not set to nil?
Those variables behave like local variables. They don’t exist outside of the function and so they are automatically garbage collected when the function finishes. You don’t need to do anything at all with them.