Sprint Stamina failsafes, Prevent player from tapping sprint repeatedly to prevent stamina usage?

I’ve recently made a stamina system and a sprint system so when you run it drains stamina after a few seconds. The only problem is you can prevent that by pressing the sprint key and releasing it before the timer by event node fires. Is there a way where I can keep track the total time the key was held down even it it was tapped? For example if I tap the key 9 times and the total time held down was equal to the time on the timer node, it would drain stamina? Or if there was a better solution, what is it and how would I implement it? Thx.

Hi , if you want you can probably get the total time it was pressed with this node

310221-getinputkeytimedow.png

and every time it reaches a certain value you could remove the amount of stamina you want .

When the player stops sprinting, you can start a timer to build up stamina.

When the player starts sprinting, you can start a timer the deplete the stamina.