Delayed Player Hit Animation

I’ve been working with a humanoid HealthChanged function to tell my clients when to animate for responsive hit detection. However, I’ve been working on a dodge system that involves the same hit detection but plays dodge animations instead. The issue is that it won’t fire the HealthChanged event since the client is taking no damage. I’ve attempted to make the client take minimal damage and heal it back quickly, but I feel that’s just avoiding the bigger problem. I’ve also tried loading the dodge animation on the attacking client’s end for responsiveness. However, repeatedly loading an animation on a separate client’s animator may lead to lag for long-term servers. Furthermore, loading the dodge animation on the hit client also replicates the animation to all other users, including the one who attacked, causing two dodge animations to play.

My current method of hit detection for the dodge is:
Client hits player > Server validates hit, sends the data back to the client > Client understands it has been hit, animates and responds

The scripts are relatively simple and I don’t think they need to be included. They follow the model above.

Here’s a video showcasing this:

I’m looking for any insight on how to approach a responsive client hit detection system without using the HealthChanged event. Or a way that I can reduce the delay between the Client > Server > Client model. I’ve searched around the forum, but nothing has really helped. I’ll try and be as responsive as I can for any further information that may be needed.

2 Likes

how about letting the server animate

If you want to achieve responsive hit detection without relying on the HealthChanged event, you can consider using RemoteEvents to send custom hit detection messages from the server to the clients. This way, you can trigger animations on the client-side based on the server-side validation without dealing with health changes. If you are doing using directly the event from the client’s side, there’s always gonna be a delay.