I'd like to know how this is done, because I'm not entirely sure how to do this. I know with Sounds you can do:
1 | local Sound = Instance.new( "Sound" ) |
2 | wait(Sound.TimeLength) |
you can do this with the AnimationTrack.Stopped
event
AnimationTracks are the objects returned by Humanoid:LoadAnimation or AnimationController:LoadAnimation
so, to wait for the animation to fniish playing, you can do this
1 | local animation = path.to.Animation |
2 | local animationTrack = Humanoid:LoadAnimation(animation) |
3 |
4 | -- somewhere else in your script... |
5 | animationTrack:Play() |
6 | animationTrack.Stopped:Wait() -- wait for the Stopped event to fire |
7 | print ( "animation stopped" ) |
alternatively, you could just wait out the length of the animation
1 | animationTrack:Play() |
2 | wait(animationTrack.Length) |
3 | print ( "animation stopped" ) |