Timer not counting down

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

I’m having issues with a timer not counting down when running my project. Here is the code, perhaps I’m doing something obviously wrong but I can’t see it :slight_smile:


var weapon_scene = preload("res://scenes/Weapon.tscn")
var weapon = weapon_scene.instance()

func _process(delta):
    if Input.is_action_pressed("fire"):


(Weapon.tscn has a timer named CooldownTimer with one-shot set to true and wait time 1 second)

func fire():
    if $CooldownTimer.is_stopped():
        print("cooldown...", $CooldownTimer.get_time_left())`

Seems pretty straightforward, but the first time I press the key says “Firing!” and every time after I get “cooldown…1”
I also added a callback on the timer’s cooldown and it never gets fired.

Thanks in advance if you can tell me whats wrong :slight_smile:

:bust_in_silhouette: Reply From: Leander

Alright, I found the issue.

I forgot to add the Weapon node to the Player, eg.


func _ready():

So… oops! Well everybody does it once, right? :slight_smile: