Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to detect when a animation is finished playing?

Asked by
hellmatic 1523 Moderation Voter
6 years ago

How can I detect if a animation is finished playing?

1
print(AnimationTrack.Length) awesomeipod 607 — 6y

3 answers

Log in to vote
1
Answered by 6 years ago

Or to add on the above answer, you can wait until it is done playing in the same block of code.

local animationTrack = humanoid:LoadAnimation(animationInstance)
animationTrack:Play()
wait(animationTrack.Length)
--finished playing
Ad
Log in to vote
1
Answered by
hellmatic 1523 Moderation Voter
6 years ago

repeat wait() until not animationTrack.IsPlaying

Log in to vote
0
Answered by 6 years ago

If you have the animation track stored in a variable, you can use its Stopped event.

myAnimTrack.Stopped:Connect(function()
    -- do things
end)

Answer this question