but it wont work and gives me an error:
Invalid set index ‘text’ (on base: ‘null instance’) with value of type ‘String’.
thanks in advance!
Your method of setting the text is correct (using the text property). However, the get_node() call is failing. So, the path you’ve provided to your node isn’t correct. If you can’t find the problem, post the layout of your scene tree and specify what node has the above script attached to it.
i couldn’t figure out how to upload an image, but the label is a child of an hbox container, which is a child of a spatial (the spatial is at the top) the script is attached to the label. i think the node path is correct becuase i right clicked the label and clicked copy path
takeda | 2020-12-15 21:46
If the script is attached to the label, then you’d just want:
text = str(score)
Since the script extends Label (I should have noticed that before), that’ll directly reference the text property on the Label.