Custom Rig Npc not playing animations

Hello! So I made a custom idle animation that I made on a custom npc rig and every time I try to play it, it doesn’t work. I have tried with multiple other animations and it hasnt worked for any of them. Here is my code that is supposed to run the animation but it isn’t playing it:

local dude = script.Parent
print("finish0")

local AnimationValue = "rbxassetid://14138511268"
local NewAnimation = Instance.new("Animation")
NewAnimation.AnimationId = AnimationValue

local Humanoid = dude:WaitForChild("Humanoid")
local Animator = Humanoid:FindFirstChild("Animator")

local IdleLoad = Animator:LoadAnimation(NewAnimation)
IdleLoad.Looped = true
IdleLoad:Play()

I have looked at many tutorials and many forums and I havent found any solutions to this. I haven’t done much with animations in the past year so please correct me if I am wrong about something

17 Likes

Hey! Would you be able to send a picture of the hierarchy inside workspace?

16 Likes

To me this code seems kinda correct to me, with one possible error that I would try:

local NewAnimation = Instance.new("Animation")
NewAnimation.AnimationId = AnimationValue
NewAnimation.Parent = game.ReplicatedStorage

And see if that changes anything. If it doesn’t, A common issue on the dev forum when Animations don’t work is an ownership issue. If the game is under a group → group must own the animation! Not you. If the game is under a different user → That different user must own it! If the game is owned by you → You must own it! If it is not an ownership issue and the above idea doesn’t work. Let me know

14 Likes

image
here is the picture, also I found out that when I rig the humanoidrootpart to the lowertorso, the character starts slowly spinning in a circle and their position and orientation aren’t changing which is very odd and could be one of the reasons that the animation isn’t playing. Again, I don’t know and I am just throwing out ideas here.

12 Likes

When you add them to the group. Did you replace this line, with the new ID? (gotta ask because sometimes people forget)

local AnimationValue = “rbxassetid://14138511268”

11 Likes

Thank you, because I didn’t know that and now I have imported all the animations to the group, but it didn’t fix it, sadly. I also ran into another issue where the avatar is randomly spinningwhich might be interfering with the animation playing somehow. I have found that it is linked to the HumanoidRootPart being rigged to the LowerTorso but the thing is, even when I delete the rig between them, it stops the spinning, but it still doesn’t play the animation. I already posted a picture of the hierarchy to another guy if you need to see that too.

9 Likes

Yes I replaced the new animation and he is still a movement-less husk.

11 Likes

I’m not into rigging as I let usually a modeler/Builder who is in the team (Often work in teams of developers) make the custom rig. But I mean make sure that HumanoidRootPart is the primary part of the model?

9 Likes

I double checked, and yes, it is the PrimaryPart.

6 Likes

P.S I used this to help me with rigging, when there is rigging troubles and usually catch the error as its a good tutorial: https://devforum.roblox.com/t/the-process-of-rigging-a-custom-character/1104770

9 Likes

I read through that and I double checked everything and I seem to have done everything correct but again, this is my first time animating/rigging a custom character.

9 Likes

Okay this is a good and bad thing because it is probably more simple of a fix than I thought, but I opened the output and it isn’t printing the “finish0” things?

7 Likes

Is it a local script in the workspace? If so they don’t run in workspace. Meaning you need to place the local script in a place that works or use a normal server script.

5 Likes

I am pretty sure that I need to use a localscript to run animations on all clients with this code, so where would I put the localscript at? (sorry I am braindead right now)

6 Likes

For all clients, thats what a server script does. Now why you would want to use a local script is if Player A sees Idle one Animation, while player 2 Sees a different animations entirely. But both are happening at the same time. Not saying that you have to use a server script, but server scripts act like an all client local script in a way

If you want to use a local script, put it in StarterPlayer → StarterPlayerScripts

and change this line according:

local dude = script.Parent

6 Likes

Mk, so I put the script in a normal script and it is printing now, but he is still not doing the animation.

5 Likes

Everything part is unanchored/CanCollide is off? You adjusted the hip height in the Humanoid? You make sure the rig type is R15 (usually the default one for custom rigs). Animations in r15? No errors in output? (Just going the list of common errors at this point)

7 Likes

When I put cancollide off, he falls off the map so would I have to do something with BallSocketConstraints or is there an easier solution? (assuming this is the reason the animation isn’t playing.

5 Likes

Keep CanCollide on with the HumanoidRootPart? (Shouldn’t have to need anything like that, I’m looking at one of the custom rigs we made and it doesn’t have any of that)

7 Likes

Ok so I somehow fixed the spinning thing from before and the humanoidrootpart isn’t making him spin anymore, but the animation is still not playing.

4 Likes