In my current project, I do all tool visualisation client-side and the collision server-side. When the tool touches a destructable part while the attack animation is playing (aka user is attacking/is using the tool), the part should be damaged. I detect the collision server-side with touched, but I’m having trouble checking whether the tool should be able to do damage (attack animation is playing). I’ve tried timers as a replacement solution, but these don’t work very well.
Is there any way to know if a player initiated animationtrack is playing through the server?
EDIT: I want to know if it’s possible to detect when the animation has stopped, on the server.
I know how to use remote events but I don’t want the tool system to be exploitable. If I use events, I’ll still need to check the time between them I think? Otherwise a player could just spam the event for longer collision.
But that introduces another problem when having multiple tools with different animation speed. You can only get the length of an animation after loading it into the humanoid as an animationtrack (and this is done on the client so the server can’t access the length for what I know).
Fixed it by using only an event for ending the tool attack , thanks for the suggestion!
The beginning of the tool attack is visually processed in a localscript client-side while the attack itself is processed in a server script for the tool. The ending of the attack can only be detected by the client, so the client sends a remote that his/her attack ended. This sets a value for the weapon that it can’t collide anymore, stopping attack collision.