Invalid get index 'text' (on base: 'null instance'). ese error en este codigo

extends CanvasLayer
var Hora = $Label2.text

func _process(delta):
var currentTime = Time.get_time_dict_from_system()
if currentTime.minute < 10:
$Label2.text = str(currentTime.hour) + “:0” + str(currentTime.minute)
$Label2.text = str(currentTime.hour) + “:” + str(currentTime.minute)

This means that you do not have a child called “Label2” as the direct child of the node the script is on. Please check your scene tree and make sure the node is where you think it is and that it’s spelled and capitalized properly. Also, the “Hora” variable should be onready because you cannot find children before they are ready.

1 Like

el Nodo Label2 si esta y la variable la quite no me servia de nada jeje