How do I prevent the character from sprinting when the stamina value is 0?

Wont these branches be enough? if a function is necessary what would be the flow of it? I did try making a function for delay but it didn’t work so I removed it.