How do I stop my animations from delaying on first play? [Solved]

Whenever I play an animation for the first time, it always either delays and comes out late or it starts playing halfway through the keyframes. This is a big problem for me as a lot of my scripts rely on animation events which often get cut out on the first play. I am preloading the tracks. Not sure if it is an issue that I am playing them server side or something.

2 Likes

Ah yes, this is due to two things:

  • The weight of the animation
  • The FadeIn value

The weight is how much the animation plays over other animations, for example, you would want a death animation (most likely) to play entirely over everything else, but a simple animation like a drink animation doesn’t have to stop everything else (like walking).

The fade in value is self explanatory, it is how long it takes for an animation to entirely fade into effect (taking in account the weight), and I believe it actually modifies the weight itself.

According to my knowledge when you call :Play() on an :AnimationTrack(), it defaults to 0.1.

To change the fade in value pass it into play like this:

:Play(0.05)

But making it zero I don’t recommend, it will look janky. You should consider changing the weight, or none of these things work, changing the animation to account for it.

Oh I assumed that animation priority is what determined which animations play over which. So does that mean the priority is not the only thing affecting this? Also why does it only happen when I play the animation for the first time in the server?

Technically, as I stated before it is. It’s only the weight because I remember reading on animation weight, and the fade in value just controls the weight and sets it to 0, and gradually increases it to the current.

OH, I know your problem! Haha you should have said this, this has happened to me, it happens because the animation isn’t loaded in. I’ve never tried to fix it because it didn’t really bother me, but you should be able to fix it by preloading the animations, maybe to some blank humanoid in the game (just a speciulation may not work)

When you say preload, do you mean to actually play the animation or just do Humanoid:LoadAnimation(Animation) in the script before it plays. Because if it is the latter then I have already been doing that

If it’s not working, then try actually playing it.

So do you think adding a loading screen to the game while the humanoid plays all the animations when the player first joins? As is seems that even after the player resets, all the animations work fine.

I’m aware of many games that do this already, they load in animations. I do not know how to do it though. It is quite literally in the name “LoadAnimation”

Trying looking into this service:

1 Like

I will do that as I am running out of options :+1:

1 Like

Just used this service on a test game by put an animation in ReplicatedFirst instead of ReplicatedStorage and using ContentProvider to preload it. Worked like a charm, the animation came out smoothly and instantly just as I wanted. You are a life saver man!

I will be adding a loading screen in addition to this new discovery to make everything load in properly before the game becomes playable.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.