Animation not playing on npc

Hello guys i really need help with animations.

I want play animation on npc when player click on gui button.

I use local script to play animation also i own game and
animations too.

script.Parent.MouseButton1Click:Connect(function()
  Animation = workspace.DummySpecial.UseAnimation

   PlayAnim = workspace.DummySpecial.Humanoid:LoadAnimation(Animation)
   PlayAnim:Play()
end)               

i use this script and problem is that i have no errors so i dont understand what can be problem
:c If there is topic like this i am sorry i tried to find one but there is nothing like this.

btw i am sorry for my bad english :,D
and sorry if it is something stupid i am kinda new.

2 Likes

Make sure that the animation is published to roblox under the same name as the game creator, otherwise it won’t work.

Humanoid:LoadAnimation() is depreciated, use this instead: Animator | Documentation - Roblox Creator Hub

Finally, make sure that your animation is looped.

1 Like
script.Parent.Mouse1Click:Connect(function()

local PlayAnim = game.Workspace.DummySpecial.Humanoid:LoadAnimation(game.Workspace.DummySpecial.UseAnimation)

PlayAnim:Play()

end)

If this doesn’t work it’s because the animations are kinda broken and doesn’t play

Hey there! it’s not a big issue, I think you forgot to set the animation priority to Action meaning that the animation is overriden by the idle animation or something else, Try setting the animation priority to Action.

(If you’re wondering it should be set while making the animation itself.)

This is your modified script try this and tell me if it worked!

script.Parent.MouseButton1Click:Connect(function()
  Animation = workspace.DummySpecial.UseAnimation

   PlayAnim = workspace.DummySpecial.Humanoid:LoadAnimation(Animation)
   Animation.Priority = Enum.AnimationPriority.Action
PlayAnim:Play()
end)  

It is probably because it is a gui button. Try looking into remote events

so i tried this and in script i use animation object and there i cant set priority, but i tried to make new animation where i set priority to action and still nothing :c no errors no animation

humanoid:LoadAnimation() is deprecated, use humanoid.Animator:LoadAnimation() instead, or use an animation controller.

so i tried animator nothing then i replaced humanoid with AnimationController and still nothing so i think there will be problem with animation :DD

yeah, is the rig r6 or r15, and is the animtion r6 or r15, and what is the animation priority?

both are r15 and priority is action

if you want, I have a model you can use! but when you finished the animations, did you set the priorities correctly?? Because if the priority isn’t set then it wont work…

Try firing a remote event to the server and playing the animation from there? If that does not work its most likely the animation. Also, put the animation controller IN the humanoid. It could also be that the NPC is not animated, you need to make sure its animated, and rigged!