So I’m trying to make an NPC that does random dance moves (animations) and then once that animation is finished (wait(track.Length)), the script is supposed to play a new animation.
My problem is that the script does not wait the actual length of the animation track and the animations overlap and give a glitchy dance.
I tried setting track.Looped = false and that still didn’t do anything.
Any suggestions on what I can do to fix the issue?
Thank you for your feedback.
Edit: I tried a print(track.Length) and the output was 0 for most of the animations.
I had a similar problem, and had actually used the ContentProvider to Preload all my anims but i had encountered a weird thing - the anims played normally but when i tried to use Anim.Length the first time the animation played the output was 0 and the next time it played it was normal. The line of code above has solved it
this here, though id replace the 1 with a 0. the idea is to wait for the animation to finish loading before taking its length and running the wait statement.
alternatively, you can do AnimationTrack.Stopped:Wait() where animationtrack is your loaded animation