How can i fix a local function firing at the start of a server?
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
1 | game.ReplicatedStorage.RequestCode.OnServerInvoke = getcode() |
Here is the function
1 | local function getcode(player) |
2 | if player.CasesOpened.Value < = (player.TimePlayed.Value/ 4 )- 1 then |
5 | player.Exploiter.Value = true |
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?