Syncing attacks with animations

Hello, just wanted to ask, is there to detect when an animation event run when animations are all replicated into clients instead of server?

i needed this since i’m creating a combat system that can wait some time before it launches its attack so players opponent have a time to react to players attack. i’m currently using yield for this, which is kinda great but i just want to know if theres another way thats better than this.

please help me if u know :slight_smile:

There isn’t really a way to detect when an animation event is run on every client. Even if there were, this could cause issues if some users have high ping which would cause the animation to run for them after other players.

If your animation is played on the server, I would just detect the animation event there and then do whatever you need to do. If you only play the animation on the clients, then yielding would be the only option.

General rule of thumb, don’t use animation events for anything important. If you know when the attack should happen, the animation’s speed, and that the animation’s speed will remain constant, you can just use task.wait().

Even if the animation’s speed does change, and you’re concerned about being precise, you can use a custom wait function instead.

1 Like