How do I stop animation when stamina runs out

So I’m abit stuck, I have set up a stamina system which works and when I press the assigned key the movement speed increases and when the stamina bar runs out the speed increase stop

What I am trying to do though is increase speed (which works) and activate an ability the runs until stamina runs out but when I use the ability (animation) it works but doesn’t stop when the stamina is empty, any ideas??

The ability is just a faster version of the basic attack