Is there a way to remove timers with the same name as the current one?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By iliekchez

Sorry, I don’t really know how to word it.
I basically just want a way to remove all timers with the same name as a new timer, to prevent timers meant for one action to be used with a similar action.
This is my current code, if that helps:

func timer(timer_length, called):
timer =
timer.set_wait_time(timer_length) = called
timer.connect("timeout", self, called)
:bust_in_silhouette: Reply From: kidscancode

If they’re going to be one-off timers and you’re planning to delete them after use, there’s a function for that: SceneTree.create_timer()

This function creates a one-shot timer. This is much easier than spawning timer nodes and adding them to the tree. It’s most often used with yield() like so:

# some code
yield(get_tree().create_timer(5), "timeout")  # delay 5 seconds
# second bit of code