I have an animation that I want to make stop before it ends
It’s within a larger script, but this is the gist of it
-- Server Script
Anim:Play() -- Plays loaded animation on a Humanoid.Animator
task.wait(Anim.Length * 0.99)
Anim:AdjustSpeed(0)
The issue is that a lot of times it stops at varying times during the animation. When it inaccurately stops, it stops NEAR the end, but not at the end.
One of my ideas is that it might be more reliable on a Local Script, so it won’t be affected by server syncing issues or whatnot?
I could use some ideas!
I don’t test a lot with syncing between animations from server to client, but you could try to make it minus from the length, instead of just waiting 0.1% of the animation’s length, like task.wait(Anim.Length-0.05).
I mainly don’t think this is the main issue, as I think it could also be with how task.wait() isn’t perfectly accurate, especially with more specific and smaller amounts of time.
So, what I would recommend, since you are always stopping at a defined time (0.1% of Anim.Length,) is to just stop the animation after waiting, and just force its TimePosition to what you expected.