Error when using animationPlayer

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Superkrypet

My Code:

animationPlayer = $animationplayer

if Input.is_action_pressed("WASD_d"):
    animationplayer.play("RunLeft")

The error:

attempt to call function ‘play’ in base ‘null instance’ on a null instance

And i use:

Func _physics_process(delta):

Superkrypet | 2020-07-31 17:13

:bust_in_silhouette: Reply From: Tort

Show screen node

Screenshot…

I think…

https://file:///H:/ROBIN/Youtube/bilder/drftgyhjuikol%C3%B6%C3%A4-.png

Superkrypet | 2020-08-01 05:32

Page not found

Tort | 2020-08-01 08:31

There seems to be a problem with using

$

But only if the node with the script is saved as a scene

I tried using the exact same code on a node not saved as a scene and it works fine

Superkrypet | 2020-08-01 09:54

A workaround might just be to Put a node2D on the top of the tree and then the kinematic body connected to it

Superkrypet | 2020-08-01 09:58

I tried the workaround and it did not work

but now i found out all of my old

$

in the same code such as

$Hitbox

still works

however i tried to reset them and they stopped working

this pretty much confirms it to be a glitch and not something that i do wrong

Superkrypet | 2020-08-01 16:40

and its only in that project too

Superkrypet | 2020-08-02 21:02

:bust_in_silhouette: Reply From: Myrmex

animationplayer