This property can only be read from. Attempting to write to it will cause an error.
This item is not replicated across Roblox’s server/client boundary.
A read only property that returns the length (in seconds) of an
AnimationTrack. This will return 0 until the animation has fully loaded and thus may not be immediately available.
AnimationTrack/Speed of an
AnimationTrack is equal to 1, the animation will take
AnimationTrack/Length (in seconds) to complete.
Playing Animation for a Specific Duration
The following function will play an AnimationTrack for a specific duration. This is done by changing the speed of the animation to the length of the animation divided by the desired playback duration. This could be used in situations where a developer wants to play a standard animation for different duration (for example, recharging different abilities).
function playAnimationForDuration(animationTrack, duration) local speed = animationTrack.Length / duration animationTrack:AdjustSpeed(speed) animationTrack:Play() end