what i did wrong

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MasterG
                   ready var player = get_node("AnimatedSprite")
	if get_global_mouse_position().y > 414 :
		if get_global_mouse_position().y < 494 :
			if Input.is_action_just_pressed("die"): 
				var mouseps = get_global_mouse_position()
				self.position = mouseps

error = Attempt to call function ‘play’ in base ‘null instance’ on a null instance

i don’t know what i’ve done but before adding it to autoload it was working

:bust_in_silhouette: Reply From: wombatstampede

Well, player is not initialized. This means that the node “AnimatedSprite” is either not found as direct child of the node where you attached that script or the first line (is it “onready”?) is actually initialized after the code below is called.

Make sure that the code gets executed after player is initialized. For example “onready” global variable initializers are actually set only after the _ready() handler is done.

So if that code is is executed inside _ready() then assign the variable right before (indenting is broken so I think that variable was declared/set elsewhere?) it. And make sure that your player node is actually found inside that script.