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

**URL:** <https://forums.unrealengine.com/t/sprint-stamina-failsafes-prevent-player-from-tapping-sprint-repeatedly-to-prevent-stamina-usage/469784>\
**Category:** AI\
**Tags:** sprint, stamina, timer, unreal-engine, keyboard, question\
**Created:** [August 15, 2020, 12:52am UTC](https://forums.unrealengine.com/t/sprint-stamina-failsafes-prevent-player-from-tapping-sprint-repeatedly-to-prevent-stamina-usage/469784 "2020-08-15T00:52:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zSSkitzz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zSSkitzz](https://forums.unrealengine.com/u/zSSkitzz)\
**Post date:** [August 15, 2020, 12:52am UTC](https://forums.unrealengine.com/t/sprint-stamina-failsafes-prevent-player-from-tapping-sprint-repeatedly-to-prevent-stamina-usage/469784/1 "2020-08-15T00:52:10Z")

</div>

_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._

---

<div class="post-metadata">

**Author:** ![panserzap](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@panserzap](https://forums.unrealengine.com/u/panserzap)\
**Post date:** [August 15, 2020, 7:09am UTC](https://forums.unrealengine.com/t/sprint-stamina-failsafes-prevent-player-from-tapping-sprint-repeatedly-to-prevent-stamina-usage/469784/2 "2020-08-15T07:09:30Z")

</div>

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

![310221-getinputkeytimedow.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/b/c/6bcb62d76d4710357c19d56e7fbd4fda5ab290f1.png)

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

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [August 15, 2020, 7:23am UTC](https://forums.unrealengine.com/t/sprint-stamina-failsafes-prevent-player-from-tapping-sprint-repeatedly-to-prevent-stamina-usage/469784/3 "2020-08-15T07:23:38Z")

</div>

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.
