AnimationTrack.Loaded, AnimationTrack.IsLoaded

As a Roblox developer, it is currently too hard to accurately yield for an Animation to load in without using a hacky approach or polling until AnimationTrack.Length is above zero.

If Roblox is able to address this issue, it would improve my development experience because then I could make sure that my animations are fully loaded before doing an operation such as the one shown below.

AnimationTrack:AdjustSpeed(AnimationTrack.Length / Humanoid.WalkSpeed)


I was creating a script to handle my mob’s animations which had their speed adjusted depending on the current Length value, accounting the mob’s WalkSpeed. I was surprised to see that none of the following methods below worked.

The following yielded forever:


if AnimationTrack.Length > 0 then
    -- Do stuff
while true do
    if AnimationTrack.Length > 0 then

The following barely yielded and still returned 0, showing it didn’t actually do anything.


The only way to currently do this from what I’ve noticed is to poll until Loaded doesn’t equal 0 which is unnecessary when there could be a native event-based approach built into the AnimationTrack instance, like we have for Sounds (bool Sound.IsLoaded and event Sound.Loaded).


Absolutely, I’m struggling with determining if animations are loaded in my game just now. It’s very awkward because I need the keyframes to exist, and having to use a wait() feels awful.


You might want to title your thread after the problem, rather than the proposed solution (API signatures).

Ref: How to post a Feature Request

This is still very relevant. I’ve been fighting a bug for over three months and it’s solely because there’s no real way to determine if an AnimationTrack is loaded or otherwise.

I have code that waits for an AnimationTrack’s length to be greater than zero before it returns the animation. Most cases, this is really all I need. An AnimationTrack’s length will be zero until it’s loaded. However, the bug lies in animations that have one keyframe at time zero - now the AnimationTrack length is zero both when it’s loaded and not loaded. This bug was so tough to figure out that it ended up making me step away from my game for over three months with occasional check-ins to see if I could solve the problem.

The solution isn’t “just make your animation longer,” for I shouldn’t need to make workarounds to implement something that should be an innate feature.

I think that a new base class is implemented that reflects all media items would be neat. This means that Decals, AnimationTracks, Videos, ImageLabels, ImageButtons, Textures and Sounds (+ more) would inherit from this class, and this base class holds .Loaded, :IsLoaded, and their AssetId. That would be exceptional.


Bump bump bump.

The only way, as said by the requester, is polling the property AnimationTrack.Length, since a change in the Length property (uppon loading) does not trigger any event, so AnimationTrack:GetPropertyChangedSignal(“Length”) or AnimationTrack.Changed never fires for this property.

I needed to know when an animation has loaded in order to get the time of some keyframes using the method AnimationTrack:GetTimeOfKeyframe, but calling this before the animation has loaded errors with the message “Invalid operation for this animation format.”.