Combat Animation Desynchronization With High Ping

In my combat system i have a combo sequence system, and everything works fine except for one issue:
Animations are played on the client side to keep them responsive, but when a player has 200ms+ ping, the server receives the AnimationEvent late, so the hitbox/swing becomes desynchronized from the animation the player is seeing.

I’m not sure if it’s better to play animations on the server or client, since both approaches have downsides.
Ideally, I want the animation to stay client-side (zero delay), but I also need the server to sync the hitbox timing correctly even when the player has high latency.

I’m trying to find a clean way to fix or compensate this
delay.

2 Likes

I had same issue in the past and I wouldn’t recommend you to play animations for character on server, it will be not really smooth for client which owns character. I needed to synchronize GUI data when animation event fired on local player to all other players, so I would say that you need to play animations on local client, connect to animation event and when it fires - play swing effect on local client (without hit validation if not needed since it is local client), but you also need to fire event to server after playing swing effect on client to make server validate hit and fire all other clients about that specific player performed swing and it need to be played on their clients. So play effects on clients, use server only for hit validation via hitboxes, also try to minimize arguments of swing effect replication, for example if player fired server that they performed swing, server validates hit and sends other players via RemoteEvent Player instance who performed swing as first argument and number that represents swing effect ID as second argument, so other players can just take swing effect from ReplicatedStorage by ID and place it at correct position.
As for me it worked pretty good even with big latencies such as 1000ms+ since server replicate animation data and effects at same time so it looks natural.