3 second timer not consistently running for three seconds

Godot Version



I have a sprint mechanic in the game I’m working on where clicking(not holding) shift activates a timer that runs for three seconds, during which you move faster, in theory. I’m running into an issue where the timer, the first time it’s started, runs for the correct amount of time, but every time after that where it’s started it runs for significantly less time.

here’s the line of code that starts the timer, in the process function

if Input.is_action_just_pressed("Sprint") && sprintCool == false:
		$Sprint.text = "Sprinting"
		Sprinting = true

and here’s the code that handles the sprint stopping

func _on_timer_timeout():
	Sprinting = false
	sprintCool = true
	$Sprint.text = "coolDown"

func _on_cool_down_timeout():
	$Sprint.text = "Ready"
	sprintCool = false

I’ve tried resetting the timer’s wait_time parameter and stopping it in the timeout function, none of which have seemed to work. any Idea what might be causing this?

I cut the timer nodes out entirely and just did it through code:

if sprintCoolTime <= 0 && Sprinting == false:
			$Sprint.text = "ready"
	if Input.is_action_just_pressed("Sprint") && sprintCoolTime <= 0:
		sprintTime = 3.0
		Sprinting = true
		$Sprint.text = "Sprinting"
	if sprintTime <= 0 && Sprinting == true:
		Sprinting = false
		sprintCoolTime = 1.0
		$Sprint.text = "cooldown"

there’s a couple lines in physics process that constantly tick down “sprintCoolTIme” and “sprintTime” by delta.

works perfectly basically first try.