How to stop stamina going down when stop sprinting?

Im trying to make it so when you are running the stamina goes down but when you stop running but still holding the shift button it continues going down? if you are standing still THEN hold the shift button it works but I cant seem to get the former working.

Your screenshot is a bit tricky to read because of how zoomed-out it is at the uploaded resolution, but I think we can still get you rolling with a solution.

For this situation, we’ll need some other event to fire when the character goes to idle and/or velocity nearly zero. As always, there are various way to tackle this, and some first thoughts might be to use a ticking function, in which case, could be a valid idea, if of course, its implemented correctly and you have the need to do many other things when the player comes to a stop. In any case, we want to begin with looking at something that probably ticks as default behavior; the Animation Blueprint.

I’m going to make a presumption that you are using some sort of locomotion (state machine\anim graph) to drive some (or all) of your characters animations. If you hop into your state-graphs, go ahead and highlight the state that might contain your characters idle animation. If you look at the details panel, under the ‘Animations States’ category, you should see (3) available events that you can configure by simply entering a name for that event.

In your case, enter a name you’d like to call the event under the ‘Entered State Event’. Compile the BP and now go to the ‘Event Graph’ within the Anim-BP; right-click in the graph to bring up the nodes context menu, hit the drop-arrow next to ‘Add Anim Notify Event’ you should now see your newly created event with a prefix 'Event AnimNotify_ followed by your named event.

With this method, I think the downside might be how you are handling the sprint event now, might need to be reconfigured, but I’ll let you take it from here. Hopefully this brings some insight to your situation and if nothing else, maybe provides some newly-more-optimized-code ideas for your project!

Thank you, I was going to take several screenshots close up but I thought that would be too complicated, this is really helping me, ill answer back if I need more help

Ive fixed it!, I used a gate however, thank you for your help though