Hello, I’ve got an issue with my client animation player, basically I’m trying to handle alot of animations within one table to make it easier, but I’m getting this error: humanoid is not a valid member of Animation
What am I doing wrong? The specific line it happens on is the if self.humanoid then
function ClientScript:PlayAnimation(animation)
if self.humanoid then
if not self.animations[animation.Name] then
self.animations[animation.Name] = self.humanoid:LoadAnimation(animation)
end
self.animations[animation.Name]:Play()
end
end
What is ClientScript? What do you set self.Humanoid as? From what I’m reading from the error and the way the code is written, it looks as if ClientScripts is defined as an animation so self becomes the Animation, so humanoid can’t be found because it’s not a property for Animations.
It’s a modulescript and the self.humanoid is set as Player.Character.Humanoid whenever the players’ character gets added. The animations are in ClientScript.animations.
Are you using WaitForChild()? I’d think it would error in the object constructor if humanoid didn’t exist and was assigned. Can you send the rest of the code where you use .__index metamethod etc.?
I don’t need the WaitForChild to invoke this since other parts of the script that use the self.humanoid work properly. Also I am not invoking .__index since I’m using this as a convenience over to having write ClientScript over and over hundered of times.
How is it not part of the ClientScript? I’m using self. on anytime I need to define the ClientScript in the script and it has worked fine everywhere else, how come is it trying to see if it is a property for the animation?