Trying to animate an NPC

So I am attempting to make an npc of my avatar play an animation, but for some reason whenever I try to do it, it’s outputting an error. It’s saying “LoadAnimation requires the asset id to not be empty” but when I replace that part with an id of the animation, I instead get "Infinite yield possible on 'Workspace.NPC.StandardReality.Script:WaitForChild(“6752798239”) I’ve tried looking for things I could do on the forum and youtube but nothing else seems to work. There should be screenshots of the errors and the script I’m using.Capture2 Capture3!Capture

Looking by the script, it seems like you’re waiting for a AnimationID or you’re trying to compare a Instance with a number? (Doubt that)

Are you sure the Animation you’re playing is owned by you?

I checked the scriptthe output I think you didn’t insert the animation id into the animation

Yes, I made the animation with moon animator and the character is from there if that matters.

animation Should be an Animation Object of some sort, and there should also be a AnimationID already made in there?

If you could give the reference of the Animation in the Explorer then it’ll help out a lot

Capture
This is where I put it, sorry if this seems obvious. I’m pretty new to this.

Strange, could you try reuploading the animation? Maybe you can’t Parent it to the script, try parenting it to the Character Model itself instead

I’m not really good at animating and stuff, but I think it would not work because it’s inside a script.

Did you put the animation Id as the name??

You need to put the animation object outside of the script, Inside the model!

This is my NPC Animation, Corrupt is right dont have the animation inside the script.
But heres my script.

local Humanoid = script.Parent:FindFIrstChild("Humanoid")
if Humanoid then
    anim = Humanoid:loadAnimation(script.Parent.Animation)
    anim:Play()
end

Guy

I see mistake right here:grafik

Caps H and non Caps H
Lua is CAps Sensitive and its LoadAnimation

'Workspace.NPC.StandardReality.Script:WaitForChild(“6752798239”) ???
Is that what ur animation is called ?
and is the AnimationId called rbxassetid:\6752798239 in Properties of the Animation

(post marked for deletion for privacy reasons)

2 Likes

Miss Typed my script yikes (didnt directly copy it) thanks for catching it

Np lol,

Sorry I didn’t respond, I was taking a break from this. But yeah its fixed! Thanks for the help.

Well how the did you fix it? erawraseraewraweraewr