Need help with progressbar/timers

Okay, so i have been playing around for a while now with the stamina bar. there was a lot of bugs but i fixed most of them but this one i cant figure out.i have not been able to fix it so i wonder if the community has any solutions. i have the stamina bar set up with a keyboard press instead of event tick.

the bug im trying to fix is when i run and stop while holding the shift key down the stamina bar does not fill up.

i want it to fill up. it only fills up when i let go

https://streamable.com/4yxyxf

Hey, i tried this and it works:

Create a Widget with Progressbar, Create a Variable with type Float and Bind it. Set the Variable to 1,0.

In Player Character in Event begin Play:

Change something at the Input to get the Info if Char is moving:

And now the Main Part of reducing and refilling Stamina:

Hey, i have not tried the solution yet, but ive heard that event ticks are bad for games. but idk if this is true? but i assume you have to use event tick when it comes to stamina and health etc

and the blueprint you have created can you like walk around and still be able to gain stamina?

You can also use a Timer:

I connected the Pressed Event from Sprint to the Timer.

At the end of “Stamina up” i set the Reset for the Timer so if Stamina is full Timer gets cleard:

ahhh gotcha, so if i use lets say a tick event for 15 different functions, thats bad right?

ahh okay so checking if a player moves etc shouldnt be a problem?
im new to unreal what does write to disk mean/do

i dont see why i should ever need that but yeah i understand. but i assume that will crash the game if ur doing it every frame. Also Thanks for helping a newbie

Also i think i fixed the problem but i havent checked for bugs yet. i used event tick to check if the player was moving or running. and that shouldnt cause it to be slower right?

https://streamable.com/lro1lc

You dont need Event Tick for Checking if Player is moving. InputAxis Move is sending hole time, even if you are not try to move your Character.

Okay good to know, but i think i have the stamina calculated in the characters blueprint or i might not.

is the stamina calculated in the ui?

ahh i see so i can just use that instead? i will try

Yeah thanks a lot mate