Trying to add a visible stopwatch timer to my game

Godot Version

Question

Tried adding a stop watch to my game but this error message keeps on appearing, im not sure why. tried asking chatgpt for troubleshoot but no luck.

with “$” you only can access child nodes, to access a brother node you must go up to the parent

try

get_node("../Clock").connect...

Sorry dont think i did it right

you dont need self, argument 2 for connect should be the callable like this:

.connect("timeout", _on_Clock_timeout)

this error now pops up

I went to the documentation to check and seems you are following the 3.5 documentation with 4.2 version

check this

func _ready():
	var timer:Timer=get_node("../Timer")
	timer.timeout.connect(_on_timer_timeout)


func _on_timer_timeout():
	pass # Replace with function body.

clock is null, i think Batiste was right about the node path being incorrect. you can just drag and drop the node into the code to get the correct path

1 Like

and you have autostart enabled in the timer?
image