Setting AnimationTrack.AnimationPriority is broken

Apparently this has been reported a number of times previously but has not been addressed yet. Setting an animation’s priority in code just seems to not work at all. Since this cannot be done with code, and we have a game that we are trying to refactor for a big update, we have to manually change the animation priorities for over 450 animations.

Example:
local animationTrack = character.Humanoid.Animator:LoadAnimation(animationInstance)
animationTrack.AnimationPriority = Enum.AnimationPriority.Action

This will not successfully set animationTrack’s priority to Action. I have tried verifying this. If I set the animation’s priority and print it, it will print:
“02:35:36.650 Enum.AnimationPriority.Action - Client - ClientCharacter:3295”

and then if I try playing the animation a few seconds later, it will print its current priority setting as:
“02:36:41.384 Enum.AnimationPriority.Movement - Client - Rifle_Semiauto:430”

4 Likes

Same problem here also :melting_face:, they need to fix real quick

2 Likes

Try Play first and then set Priority. Because Play() resets everything set to default.

AnimTrack:Play()
AnimTrack.Priority= Enum.AnimationPriority.Action
1 Like

Thanks for the report! We’ll follow up when we have an update for you.

1 Like

Hi there, thanks for the detailed report. I’m currently looking at this issue and unable to reproduce the behavior (even when setting the Priority before calling Play). This is what I have:

LocalScript in StarterPlayer/StarterCharacterScripts:

local Players = game:GetService("Players")

local player = Players.LocalPlayer
local character = player.Character

-- Ensure that the character's humanoid contains an "Animator" object
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

-- Create a new "Animation" instance and assign an animation asset ID
local kickAnimation = Instance.new("Animation")
kickAnimation.AnimationId = "rbxassetid://616010382"

-- Load the animation onto the animator
local kickAnimationTrack = animator:LoadAnimation(kickAnimation)

-- Setting Priority
print("Before setting Priority: ", kickAnimationTrack.Priority)
kickAnimationTrack.Priority = Enum.AnimationPriority.Action2
print("After setting Priority:", kickAnimationTrack.Priority)

print("waiting 4 seconds...")
task.wait(4)

-- Play the animation track
kickAnimationTrack:Play()
print("After play: ", kickAnimationTrack.Priority)

print("waiting 10 seconds...")
task.wait(10)
print("After 10 seconds: ", kickAnimationTrack.Priority)

For me, this prints out:

  11:48:56.832  Before setting Priority:  Enum.AnimationPriority.Action  -  Client - LocalScript:16
  11:48:56.832  After setting Priority: Enum.AnimationPriority.Action2  -  Client - LocalScript:18
  11:48:56.832  waiting 4 seconds...  -  Client - LocalScript:20
  11:49:00.835  After play:  Enum.AnimationPriority.Action2  -  Client - LocalScript:26
  11:49:00.835  waiting 10 seconds...  -  Client - LocalScript:28
  11:49:10.852  After 10 seconds:  Enum.AnimationPriority.Action2  -  Client - LocalScript:33

Which seems correct to me. Is there anything I’m missing in my setup?

@ChadTheCreator Can you also clarify whether you used a LocalScript or a Script for this? Thank you.

I’m going to close this thread because we are unable to reproduce the bug. However, please feel free to re-open it and provide a repro if possible.

One more detail that might help: if you use a local script to change the animation priority, it will only work for your player character. Other characters require server-side script to change the priority.