How do I make something that you click every 50 seconds

Godot Version



Im super new to coding and the only thing that helped me was gdquests free short course but I don’t have money for its paid version so I am confused with what I am trying to make right now. I have a stopwatch in the game, and I want there to be a button that you have to click every 50th second or else you lose. The thing I’m really confused about is how I would implement clicking with a timer.

here is a script to put in a button. if the button isn’t clicked after 5 seconds, it turns red. click the button to reset the elapsed seconds

extends Button

# varable for elapsed seconds
var m_elapse : float = 0

# function to call when clicked
# reset elapse time
# set color back to normal
func ButtonClicked():
	m_elapse = 0
	self_modulate = Color.WHITE

# connect function ButtonClicked with pressed signal
func _init() -> void:
	connect("pressed", ButtonClicked)

# function called every frame
func _process(delta: float) -> void:
	# add to elapsed seconds
	m_elapse += delta
	# set button title to seconds elapsed
	text = str(m_elapse).pad_decimals(1)
	# if elapsed seconds more than 5, color button red
	if(m_elapse > 5):
		self_modulate = Color.RED

Thank you, this is very helpful