Animations do not override

I think I’ve found a bug and since I can’t post in #Bugs I decided to share it here.

If you load two animations with the same priority the animation that is played last will always override the animation played first. However, the animation played first will never override the animation played last, making me believe it is not intended behavior.
This happens in both studio and in published games.
Here is some example code:

local player = game:GetService("Players").LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

local aim = animator:LoadAnimation(script:WaitForChild("aim"))
local hold = animator:LoadAnimation(script:WaitForChild("idle"))

aim:Play()

task.wait(5)

hold:Play()

task.wait(5)

aim:Play()
-- Aim does not play, instead hold continues playing

Both of the animations have the same priority, yet hold is not overriden by aim.

I guess you can :Stop() it, then Play() it after, but a holding animation should have the Idle priority, while aim has the action priority

I’ve solved my issue. But I’m not sure that this is intended behavior and believe this might be a bug.

I’ve been having a ton of issues with Roblox animations. I’m not sure if it’s any value to you anymore, but my solution was to disable the animate script inside the character, stop all playing tracks (I think you can get them with Humanoid:GetPlayingTracks() or something, probably need to google it), and then play the new animation. Then just enable the animate script once the animation is done.

If you want to override animations, you’ll need to set the priority.
The AnimationPriority Enum determines how animations should interact with each other when played at the same time.

2 Likes