Why won't NPC load animation?

Hey, I’m trying to make an NPC play an animation but it isn’t working. Do you have any ideas why it isn’t.

local folder = game.Workspace:WaitForChild("CharacterFolder")
local humanoid = Folder:WaitForChild("Soldier"):WaitForChild("Humanoid")
local anim = humanoid:LoadAnimation(humanoid:WaitForChild("Animation"))
anim:Play()

try Anim.AnimationPriority = “Action”

1 Like

Try Using

wait(5)

local hum = script.Parent.Humanoid

local anim = hum:LoadAnimation(script.Parent.Anim)

anim:Play()

And make sure there’s an animation in the NPC, and make sure you are the uploader of the animation or it wont work since it is not owned by you, If You would like to use the personal model I made for an animated Model, Then I’ll be glad to send it to you,! Hope this works though.

2 Likes

@BurritoMuncher56 Oh I didn’t make the animation. I copied roblox’s default running animation. So is that why it isn’t working?

@FruitySama That didn’t work, but thanks for trying!

Hit f9 does it load or error:“?”

Just upload the animation to your profile then! and that’s all you need to do then it should work.

1 Like

LoadAnimation is deprecated and shouldn’t be used Humanoid | Documentation - Roblox Creator Hub

Please refer to this: Using Animations | Documentation - Roblox Creator Hub

1 Like

No errors, alright @BurritoMuncher56 @WooleyWool I’ll try both of those, thanks.

Oh I am so dumb. I’m sorry, I just realized that I anchored all of their parts.

Oh lol, but I still don’t think an animation will work in game because its not directly uploaded to your profile.

I don’t know why, but it worked for me to use the roblox default animations. Maybe because they are default animations Roblox is ok with me using them? I’ll give you the solution because that could help in the future with non-Roblox animations. Thanks everyone!

Oh, Yea it is most likely because its a default, my bad.

1 Like