Make stamina value only drain when sprint button is held and player is moving?

I know this is 3 months old but I found threads with similar questions (I needed this as well) and found a solution through different threads.

You and I followed the same Sprint-tutorial and it’s pretty simple to implement the “drain-only-when-moving”-feature:
First we check if the player is Sprinting (holding down Shift) - if it’s false, we’ll regain stamina. If it’s true we move on to check if the player is actually moving. We do this by getting the velocity of the player and checking if the velocity in any direction is equal 0, which means he’s standing still. If he’s not standing still (false) he’s Sprinting and we drain Stamina. If he’s holding down Shift but not moving (true) we should be regaining Stamina.

Credit to for suggesting “get velocity”.

(How to detect player movement? - Blueprint - Epic Developer Community Forums)