LoadAnimation requires an Animation object

I’ve scoured all over dev forum to find an answer, looking at multiple ‘LoadAnimation requires an Animation object’ posts but nothing worked in my case. I’ve tried using a while loop to detect when the humanoid has been loaded, WaitForChild(), clone the animation into the npc and then play it, but nothing seemed to work.

I am using motor6d animations for this and the animations have been published.

I’ve been at this error for the last 2 or 3 days maybe, hoping that I would find a breakthrough, but nothing. I’ve also created another post for this but I didn’t get an answer and i’m quite desperate.

Please help.

		if idleAnim then
			idleAnim = hum:LoadAnimation(idleAnim)
			NPCProperties.IdleAnim = idleAnim
			idleAnim:Play()
		end

1 Like

Make sure that:
1: You are passing an animation instance, not just the animation ID.
2:You are referencing the correct object. (A print of the variable could reveal the problem)

2 Likes

I am doing both of those things, idleAnim is an animation object and I am referencing the correct object as sometimes 1 or 2 of those ‘sword noobs’ that are broken actually move and have their correct ai functioning.

1 Like

Were are the animations contained? If they are published, and you are passing the correct object (the animation), then :LoadAnimation() should be working.

I would double check the names. If the animations are sometimes working then it could be that: There are two or more objects of the same name are being referenced by the script instead of the animation.

1 Like

the names are correct, idleAnim is an instance, meaning that it is referenced directly like game.ReplicatedStorage.thing.anim as an example, loadanimation works sometimes which is weird, maybe I am experiencing an engine bug? I am making a lot of clones of an object all at once and then applying the script to that.

anyone wants a place download or something, I will be glad to give one

uhh somehow I fixed it? I do think that I encountered an engine bug that time, I just moved the animation object into the npc and it worked, this was just a really unusual thing to debug, and HOOORAY after a week of work I did it!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.