Play custom animation from script that located outside its dummy

Hi
I want to ask about ho to play my own animation from script that located outside its dummy, because I want to play it from the dialogue.
Here is the script that I have, this script is located in its dummy

local animation = script:WaitForChild('Animation')
local humanoid = game.Workspace.Dummy :WaitForChild('Humanoid')
local dance = humanoid:LoadAnimation(animation)
dance:Play()

Thanks!

I don’t understand what you are asking.
But I’ve noticed a bad-practice so I will note it out.

local humanoid = game.Workspace.Dummy :WaitForChild('Humanoid')

You’ve said that the script is located inside the Dummy, I don’t know why you don’t reference it
by script.Parent but rather through workspace[...], in cases of duplicationed names, this will mess up a lot.
Other than that, is the script a LocalScript or a Script?

1 Like

So, I have the dialogue script, where all of the dialogue are there and I want to insert the animation after sort of time, maybe like after the dialogue “Lets go!” then the animation is playing.

Humanoid:LoadAnimation is the problem.

It’s now Animator:LoadAnimation.

Oh, Okay then. I will try, Thanks

This is the soluion, sorry for asking a dumb question

2 Likes

You ask questions to learn, I don’t know what’s dumb with that.
And no problem!

1 Like