Godot Version
Godot-4
Question
Hello! I know that this question has been asked many times previously, however I cannot find my exact problem in the many forums and posts for this issue. Please bare with me. I am new to programming and game dev, so I followed a tutorial to make a small 3D-platformer. The tutorial portion went without issue. I am currently trying to add to it, so that when I make bigger projects later on I have a place to point to, or a knowledge base, to work from on my computer.
I am trying to make a lives system, so that when you run into an enemy, you lose a life. Below you’ll see the code that is giving me the null error for the “LivesLabel” line. Following that, I have the code that I was mirroring for collecting coins and changing the “CoinsLabel”. Both have the export variable for the HUD canvas layer. Both are identical, but I only get an error for the “LivesLabel” one.
I understand that heirarchy of nodes is important, both labels are direct nodes in the HUD scene. The only parent in the scene is HUD. I have been staring at it for about 2 hours, but I can’t think of anything to fix it. Any help would be appreciated!
@export var hud : CanvasLayer
hud.get_node("LivesLabel").text = str(Global.lives)
hud.get_node("CoinsLabel").text = str(Global.coins)


