Please help i am new

Godot Version

`Godot_v4.2.2

Question

Every time i try to change text label to some number is says:
Invald set index ‘text’ (on base: ‘Label’) with value of type ‘int’
code looks like this:
var health = 100
func _ready():
$Label.text = health

The variable health contains an integer, but the text requires a string, so you need to convert from integer to string.

Try one of these:

	$Label.text = "%s" % health
	$Label.text = String.num(health)

i will try

Bro u are a life savior.I was trying to fix this for 2 days i watched so many videos, so i cant tell you how much i am happy bro.Thank you again

1 Like