Animationplayer showing as null

Godot Version

4.2.2

Question

Getting error “Attempt to call function ‘play’ in base ‘null instance’ on a null instance” I’ve checked the parenting in both local and remote and everything looks great, screenshot attached:

the only thing you can do for this to add delay on _ready() call
try add:

await get_tree().physics_frame 

on the first line of _ready() function

I added that line right after _ready() and I’m getting the same error sadly.

how about you add it like this:

await get_tree().create_timer(5).timeout

will it still show the same error at the same line ?

Same error on same line :c

Is there a better way to do this?

try @export var instead
i see you done that on for basic Variants, you can also do that for Nodes
just do like

@export var _animation_player:AnimationPlayer

replace the @onready var you already have
then assign the badplayer AnimationPlayer via inspector dock
run the game, if it still error then
do you have an error in the Enemy Script? copy and paste the code to here
use this for better readable code:
image
it does feel like your Enemy.gd has an error, so it doesnt recognize this script