How to put a int as a variable and a string in a label (all the other posts were too old)

Godot Version

4.3

Question

im trying to make a health bar with a label but all the methods ive seen people use for example

$Label.text = str(Global.health)

it just says Invalid assignment of property or key ‘text’ with value of type ‘String’ on a base object of type ‘null instance’. anyone know why?

Looks like it is not finding $Label. Make sure you are using the right path for that node.

ohh its cause I changed its postion on the node tree mb

To avoid this, you can take advantage of scene unique nodes: Scene Unique Nodes — Godot Engine (latest) documentation in English