Hey so I have a system in my game where you can hold down a key to charge up a meter which works fine.
The value of the meter (how much is charged) is a numbervalue inside of the player.
Certain abilities in my game will require X amount of this meter to be charged to be used.
Now the issue/concern:
When using a move the client will check this value inside of the player to make sure they have enough meter charged to use the move. If the player has enough meter the client will fire a remote event to the server to use the move. The server will also check to make sure the player has enough meter and if not they will be punished.
Couldn’t a laggy player accidentally fire the remote event when they don’t actually have enough meter? How could I prevent this from happening?
Yes. The client checks and prevents the user from using the move if they dont have enough.
The server checks if they have enough and if they don’t they get punished.
Then what is the point of your topic? because you’re saying that you also check on the server whether or not their meter is full so there is nothing to worry about or am I missing something?
“Couldn’t a laggy player accidentally fire the remote event when they don’t actually have enough meter? How could I prevent this from happening?”
You shouldn’t think that only exploiters exist when making an anti-cheat, but also consider laggy players (or more like, false positives).
I have a similar system on my game where the client first checks if the player can attack and if it can it fires a remote, then the server does its own checks too. Instead of punishing the client (that is, kicking them or killing the player’s character) if they tried to attack when they can’t, I simply don’t let them attack. For this kind of things you shouldn’t punish players but rather make sure they just can’t attack if the requirements you specify aren’t met (in this case the meter you talked about).
The only times I kick players is when they destroy specific instances from their character to glitch the game (for example, destroying the humanoid’s animator can cause problems in my game) because i’m sure that can’t be “lag” but someone purposely trying to destroy it.