I wrote this script to design countdown in my game:
extends Container export (int) var minutes = 0 export (int) var seconds = 0 var dsec = 0 func _physics_process(delta): if seconds > 0 and dsec <= 0 : seconds <= 1 dsec = 10 if minutes > 0 and seconds <= 0: minutes -= 1 seconds = 60 if seconds >= 10: $sec.set_text(str(seconds)) else: $sec.set_text("0"+str(seconds)) if dsec >= 10: $dsec.set_text(str(dsec)) else: $dsec.set_text("0"+str(dsec)) if minutes >= 10: $minutes.set_text(str(minutes)) else: $minutes.set_text("0"+str(minutes)) func _on_Timer_timeout(): dsec -= 1 Here's what the UI section looks like:
When I play I get this error:
Error: attempt to call function 'set_text' in base 'null instance' on a null instance.
Where is the problem with my script?
And I also wrote 00 in the text section of the minutes inspector, 00 in the seconds inspector, and 0 in the dsec inspector.
When I want to move them separately, I can't and they are all stacked on top of each other.
I want to know how I can move them so that 00:00:0 can be seen next to each other?


Nodewith the nameminutes, but you try to use it form code$minutes. Similarly you have aNodecalledminthat you don't use. Which leads me to believe this is caused by a typo. \$\endgroup\$