displaying health (godot 4 2d)

Godot Version

godot 4


← I’m trying to display my player’s health with label (2d). I’ve been trying for hours but I just can’t make it work →

This information is not enough, therefore if you want to create a health label then I think you have created it, to the show player health do like this label.text = "Health: " + str(player.health)

1. Create a Empty scene

2. Create a Label2D

3. Add script to Label2D

4. Add in script a string:

var Health: int = 10

5. Write a _ready() function

6. Add a string in _ready():

text = str(Health)

If my brain compiled it correctly, you’ll see the number 10 on the screen.