PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

GetMarkerReachedSignal

This function returns an DataType/RBXScriptSignal|event similar to the AnimationTrack/KeyframeReached event, except it only fires when a specified KeyframeMarker has been hit in an Animation|animation. The difference allows for greater control of when the event will fire.

To learn more about using this function, see Animation Events in the articles/using animation editor|Using the Animation Editor article.

More About Keyframes

Keyframe names can be set in the Roblox articles/using animation editor|Animation Editor when creating or editing an animation. They cannot, however, be set by a Script on an existing animation prior to playing it.

Keyframe names do not need to be unique. For example, if an Animation has three keyframes named “EmitParticles,” the connected event returned by this function will fire each time one of these keyframes is reached.

See Also

  • AnimationTrack, controls the playback of an animation on a Humanoid or AnimationController
  • Keyframe, holds the Pose|Poses applied to joints in a Model at a given point of time in an animation
  • Keyframe/AddMarker
  • Keyframe/RemoveMarker
  • Keyframe/GetMarkers

Parameters

Name Type Default Description

The name of the KeyFrameMarker the signal is being created for.

Returns

Return Type Summary

The signal created and fired when the animation reaches the created KeyFrameMarker.


Code Samples


Listening to Keyframe Markers

This LocalScript code waits for the local player’s Humanoid object to load, then it creates a new Animation instance with the proper Animation/AnimationId|AnimationId. The animation is then loaded onto the humanoid, creating an AnimationTrack, and the track is played with AnimationTrack/Play|AnimationTrack:Play(). Following that, the AnimationTrack/GetMarkerReachedSignal|GetMarkerReachedSignal() function detects when the “KickEnd” marker is hit.