cant find node returns null

I reproduced a bug here’s the code:

extends Control
var score = 0
@onready var label = $Label
#or get node they both dont work

# Called when the node enters the scene tree for the first time.
func _ready() → void:
** pass # Replace with function body.**

# Called every frame. ‘delta’ is the elapsed time since the previous frame.
func _process(delta: float) → void:
** score +=1**
** label.text = str(‘Score:’)**
** strong text**
please tell me how to solve the problem

this gives error:
Invalid assignment of property or key ‘text’ with value of type ‘String’ on a base object of type ‘null instance’.
label is null(cant find it maybe)
i checked if it exist and the path is correct.can you help me : :grinning: :grinning: :grinning:

Can you show your scene tree?

Hello, @sigmamaul9!

Then a node at var label is not Label class. As @gertkeno mentioned, show your scene tree to we try help you. Also correct this:

@onready var label: Label = $Label

thanks here’s the scene tree

thank you
I used dropbox

So, try this:

@onready var label: Label = get_node("Label")

instead of

@onready var label: Label = $Label

I used that instead same error
here’s a bigger picture

just in case you need it

As a habit I like to name the script the same as the node it is attached to.
In your case your top level node is not yet given a name (Control) but the attached script is may be called ‘score.gd’. Is the ‘score.gd’ script attached to the ‘Control’ scene node?
And is the Control node script the one you are running? I can’t tell from the image.

Alternatively…
Is it possible you are running the score.gd script in more than one place?
Do you have it attached to any of the other nodes or even as an autoload?

Was this Score.gd autoloaded?

well its a bug I
reported