This item is deprecated. Do not use it for new work.
For thread safety, this property is not safe to read in an unsynchronized thread.
The AnimationPlayed event fires when an
AnimationTrack begins playing on the
A common use for this function is to connect the
AnimationTrack/KeyframeReached event for the playing AnimationTrack, so additional effects can be added to the animation (for example
This event can be used for any
Humanoid regardless if it belongs to the local player’s client or not.
- For the
AnimationControllerequivalent of this event, please see
Pausing An Animation When a KeyFrame is Reached
The example below pauses any AnimationTrack playing on the humanoid when a keyframe named ‘PausePlayback’ is reached.
humanoid.AnimationPlayed:Connect(function(animationTrack) -- make sure the track exists if not animationTrack then return end local connection -- connect the KeyframeReached event connection = animationTrack.KeyframeReached:Connect(function(keyframeName) if keyframeName == "PausePlayback" then -- adjust speed to 0, pausing the animation animationTrack:AdjustSpeed(0) end end) -- disconnect the KeyframeReached event when the animation finishes animationTrack.Stopped:Wait() connection:Disconnect() end)