how to change timer duration while runing code?

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

im using this code to start timer with latency that announced in var “attackSpeed”

var _timer = null
var duration = 4
func _ready():
    _timer =
    _timer.connect("timeout", self, "_on_Timer_timeout")
    _timer.set_one_shot(false) # Make sure it loops
func _on_Timer_timeout():

then i created a button which has to decrease duration var with 1

  func _on_Button3_pressed():
    	duration -= 1

and how to make timer changing by 1 while it running?

:bust_in_silhouette: Reply From: hrp

actually just found by myself
add to the button click

func _on_Button3_pressed():
	duration -= 1