Collapse Sidebar


Returns the time position of the first Keyframe of the given name in an AnimationTrack. If multiple Keyframes share the same name, it will return the earliest one in the animation.

This function will return an error if it is uses with an invalid keyframe name (one that does not exist for example) or if the underlying Animation has not yet loaded. To address this make sure only correct keyframe names are used and the animation has loaded before calling this function.

To check if the animation has loaded, verify that the AnimationTrack’s AnimationTrack/Length is greater than zero.


Name Type Default Description

The name associated with the Keyframe to be found.


Return Type Summary

The time, in seconds, the Keyframe occurs at normal playback speed.

Code Samples

Jump To Keyframe

This sample includes a function that will jump to the first keyframe of a specified name in an AnimationTrack.

As AnimationTrack.TimePosition cannot be set whilst the animation is not playing the function first checks to see if the animation is playing.

This sample will only work once an Animation has loaded.

local function jumpToKeyframe(animationTrack, keyframeName)
	local timePosition = animationTrack:GetTimeOfKeyframe(keyframeName)
	if not animationTrack.IsPlaying then
	animationTrack.TimePosition = timePosition