animatedsprite2d play() null

i have a child node ‘animatedsprite2d’ with sprite frames, but when I call play() in _ready() it states *'attempt to call play in base ‘null instance’ on a ‘null instance’;
not sure what I am doing wrong?

the animated plays clearly on scene, but when i click play() the animation doesn’t play.

Maybe type self.play(“default”)?

1 Like

Indeed. A bit more explanation why:

If you write $animation.play(“default”), that script will look for a child node named ‘animation’ and try to call the play() function of it. Since the node your script is attached to is already the node you want to call play() function, you should just write play(“default”). In general you don’t need to write self. to call a function of its own, but you can if you want.

1 Like