I would like to know how I can check if an animation has played
KeyframeReached Event fires for specific keyframes or Stopped Event fires for when an animation has been stopped. You can yield your scripts until the event is fired or you can set variables once the animation has either stopped or reached the end of its track.
Note: Stopped Event will fire once it has stopped, this will still fire even if it doesn’t reach the end of it’s track or is stopped by another script.
For example:
AnimationTrack.Stopped:Wait()
or
local FinishedPlaying = false
AnimationTrack.Stopped:connect(function()
FinishedPlaying = true
end)
or
local FinishedPlaying = false
AnimationTrack.KeyframeReached:connect(function(KeyframeName)
if KeyframeName == "FinalKeyFrameName" then
FinishedPlaying = true
end
end)
2 Likes