Make stun animation last for the duration of the stun given?

In my game there is a stun system where players can get stunned for different amounts of time, and I want the stun to visualized to the player so they can understand and also have a smoother gameplay experience. I tried to make the stun animation last for 1 second, and then when its played, I set the length when I play it by Animation:Play(length) but it doesn’t really work as expected. The animation just, looks funny? I don’t know. One game I’m aware of that has perfected what I am trying to accomplish would be The Strongest Battlegrounds.

1 Like

Why not have the animation on loop. Then just stop the animation when you don’t want it anymore?

Would not achieve the effect of the impact as I wanted

Animation:Play() takes 3 arguments (and you cannot directly set an animation’s length). You can adjust the third one (playback speed) so that your animation plays for the desired time.