PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GetMarkers

This function returns an array containing all KeyframeMarker|KeyframeMarkers that have been added to the Keyframe. Note, this function will only return Instance|instances of type KeyframeMarker.

More about Keyframes

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

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

See also

  • Keyframe/AddMarker
  • Keyframe/RemoveMarker

Returns

Return Type Summary

An array containing all KeyframeMarker|KeyframeMarkers that have been added to the `Keyframe


Code Samples


Get Keyframe Markers Attached to a Keyframe

This example demonstrates the Keyframe/AddMarker and Keyframe/GetMarkers functions. After adding two markers, marker1 and marker2 to the keyframe, this example gets and prints the names of the added markers.

local keyframe = Instance.new("Keyframe", workspace)

local marker1 = Instance.new("KeyframeMarker")
marker1.Name = "FootStep"
marker1.Value = 100

local marker2 = Instance.new("KeyframeMarker")
marker2.Name = "Wave"
marker3.Value = 100

keyframe:AddMarker(marker1) --marker.Parent = keyframe
keyframe:AddMarker(marker2) --marker.Parent = keyframe

local markers = keyframe:GetMarkets()
for _, marker in pairs (markers) do
	print(marker.Name)
end