I am making a combat system? And the character play a punch animation and the client side will fire a remote event to the server side when reach marker signal. When server receive and it will create hitbox, deal dmg…
The problem is I want to ask how to let the server side know is the character playing the punching animation. Because when the character use a combat skill. The system need to make sure the character is not punching. If the character is punching, then cannot use that combat skill.
I tried to fire a remote event of start signal and end signal of punch animation but I am worrying about will there is a hacker remove the line of start and end remote event and causing the server dont know the character state and causing some other problem
If I use a loop to keep checking is the character playing that animation, I think the server will lag.
Anyone can suggest any solution for this? I want the solution can make sure no hacker/exploiter can interact the main system.
But if I leave hit detection to the client side, exploiter can add character that cannot hit into the hit character array thing. And if I need to validate on the server side, I need to create a hitbox on the server side too. Therefore, I need to create hitbox on the server side. I think. Thank you
No, you should do the hitbox on the client as @Ziffixture said, you can perform sanity checks in the server without having to redo the hitbox there too. But of course if you don’t care about performance/delay, then it’s okay to do it on the server. Anyways, that isn’t even your question .
Now to actually reply to your question, as far as I know there isn’t a way to safely check if a client is playing an animation. Playing an animation from the client will replicate the movements to the server, sure, but it wont actually appear as playing on the humanoid.
You could technically fire a remote function and ask that client what animations it’s playing, but this is very unreliable and dangerous because of exploiters.
I think I have solve my problem by using a method but could you explain more about the create hitbox on client side? I want to know what do I need to do with it. Thank you.
Each client renders their own hitbox (good for performance) → If they hit someone, fire a remote event → The server listens for the remote event and makes sanity checks to make sure that hit was possible → If the hit was possible, deal the damage
There is many sanity checks you can perform to make sure that hit was authentic.
You could check for the following stuff as example:
Check if the distance between the attacker and the target is not too long (To prevent exploiters from creating huge hitboxes)
Check for the time passed between hits (To prevent exploiters from quickly spamming attacks)
There is many checks you’ll need to make to avoid exploiters, these were just some examples, but if done correctly it can result in a very smooth experience for players while being not too exploitable.
I would recommend speaking with someone who is more profusely knowledgeable on this topic