In my game i have a case system and the server script has a local function within it that requires a player value given by the OnServerInvoke shown below
This is for an anti-exploit
game.ReplicatedStorage.RequestCode.OnServerInvoke = getcode()
Here is the function
local function getcode(player) if player.CasesOpened.Value <= (player.TimePlayed.Value/4)-1 then return secretcode else player.Exploiter.Value = true end return nil end
However this function seems to fire right at the start of the server and it causes the system to break completely. I checked for anything else that could be firing the invokeserver request but only cases (what it was meant for, not fired at the start of a server) and i've checked for any getcode() calls in the script but only the OnServerInvoke request has it
Debugging also doesn't help here, i don't like when people just say DEBUG
DEBUG DOESN'T ALWAYS HELP
So please, is there some way i can get it to stop firing on server startup?
Simple fix, Change:
game.ReplicatedStorage.RequestCode.OnServerInvoke = getcode()
to this
game.ReplicatedStorage.RequestCode.OnServerInvoke = getcode