Hey everyone! I am probably over complicating it in my head, but I am trying to figure out how to set an Animation priority.

Pretty much, I am making an NPC that chases you, and when they touch you, they punch and do damage. I would like to add a separate animation for punching. I believe that my script works, since there are no errors, but the punch animation doesn't play. I suspect that it starts for a second, but then gets overwritten by the walking animation.

I read this article, but I'm still not sure how to do it: https://developer.roblox.com/en-us/api-reference/enum/AnimationPriority

I have an Animation inside of a script. This is the code I already have regarding the animation:

local animation = script.Parent:WaitForChild("Punch")
local humanoid = script.Parent:WaitForChild('Humanoid')
local dance = humanoid:LoadAnimation(animation)

dance:Play()

How can I change the animation priority to "Action"? Thanks everyone!

2 comments

1

If you're the owner of the Animation, then reupload the Animation under said Priority. I am not sure if you can override it through 'AnimationTrack.Priority = Enum.AnimationPriority.Action'; if you don't own the Animation, then you cannot use it; ensure that the RIG type supports the RIG type of whom it's loaded onto.

0

Pretty much what Ziffix said. Do dance.Priority = Enum.AnimationPriority.Action.