How to stop stamina going down when stop sprinting?

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