Issue with Accessing Label Nodes in HUD Scene

Hello everyone,

I’m developing a marketplace for trading eggs that I call water and fire types. To manage this, I’ve created three scripts: one handles player data, another manages the HUD (which includes two labels to display the player’s egg inventory), and the last script facilitates egg transactions through market buttons. My objective is to enable players to use in-game currency to buy and sell water or fire eggs and to accurately display the quantities of each egg type on the screen the player has in total.

However, I’m facing some challenges: attempts to interact with either the water or fire egg labels result in a “label node not found” error, and despite being singletons, the HUD labels do not appear in the market scene. The errors I’m encountering are: “Invalid set index ‘text’ (on base: ‘null instance’) with value of type ‘String’.”

I can click on the fire and water buttons a few times before the game crashes, and I’m also unable to see my HUD buttons displayed in the market scene. If anyone could provide some insight on how to fix this, I would greatly appreciate it.

Thank you!

You can find here the codes of my 3 scenes:

These kinds of errors are all about getting the name (and path) of the node you want right.

Try dragging a node into your code while holding ctrl (or is it alt?) and it will write the correct path for you.

I did, but maybe I am doing it wrong?

Although your script is on the root, maybe try:
@onready var test = $"../Fire_Egg"

Am confused why the error says Egg_Fire though. That’s weird.

Do you have a demo project I can clone?

I just redid my code by following this tutorial and it’s now working!