Checking for active client initiated animationtracks on server


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.

Thanks in advance.

You can use a RemoteEvent in this case. Here is a very helpful article by Roblox that should show you how to use them in your case:

If you need more explanation let me know.

1 Like

Thanks for the answer!

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.

Yes you do need to check time OR you can disable the script for a certain amount of time using wait() in a separate script.

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).

1 Like

Fixed it by using only an event for ending the tool attack :slight_smile: , 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.

1 Like

Ok, glad I could help! Could you mark what worked as the solution please?