_ready: Invalid access to property or key 'animator' on a base object of type 'Node (PlayerModel)'

Godot Version

4.6.1

Question

I’ve been following this youtube tutorial https://www.youtube.com/watch?v=kK5NXyIsEQI&t=668s

and at around 6min i get the error in the title I don’t understand why.

could someone help me ? I’m pretty new to game coding i’ve done a few small projects before but I’m trying to do a real game for once, and I’ve pretty much followed the video i have my own simple model with a skelelten and only 3 animations but it should work should’nt it ?

extends CharacterBody3D


@onready var input_gatherer = $Input as InputGatherer
@onready var model = $Model as PlayerModel
@onready var visuals = $Visuals as PlayerVisuals



func _ready():
	visuals.accept_skeleton(model.skeleton)
	model.animator.play("default")
	

func _physics_process(delta):
	var input = input_gatherer.gather_input()
	model.update(input, delta)
	

	
	
	

Your node paths may be different, make sure to paste your afflicted code and a screenshot of your scene tree would help too.

Might be, I’ve uploaded a screenshot with the tree and part of the code that I think is responsible anda dded the rest in teh code part

Looks like your Model.gd script just doesn’t have a animator variable. You will have to define it in order to access it. I suppose you’d want it to equal the AnimationPlayer

@onready var animator: AnimationPlayer = $AnimationPlayer

I swear i tried that once, then right before editing i wrote it again but deleted it before sending but yes you are right that was the problem

thank you so much