Animation on object doesn't seem to work

I made a crate, named Common
imagem_2024-09-25_215547181
Everything is setup correctly, the primarypart of the model, names, welding etc everything needed to a custom rig.
But for some reason when I run this line of script this error appears:
imagem_2024-09-25_215732758
imagem_2024-09-25_215748269
On the line local track = vcrate.Humanoid:LoadAnimation(script.CrateAnim.AnimationId) the error appears, and i don’t know what it is. Before trying with a humanoid, I also tried putting an animation controller and animator on the crate, same error

humanoid:LoadAnimation requires an Animation object, in this object is where you’d provide the AnimationId. I think script.CrateAnim looks like an animation so you should be able to use this.

vcrate.Humanoid:LoadAnimation(script.CrateAnim)

On a side note, loading animations via the humanoid is deprecated so I would swap to using the animator instead.

3 Likes

seems like error is gone, but now the animation doesn’t play. is that because animations in view port frames don’t run? or something like that i have no idea

Yeah, animations in viewport frames won’t work unless you have a WorldModel inside of the viewport frame. You’d also parent the dummy to the WorldModel. Then animations should work.

2 Likes

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