Detect When Sprinting

Hi, I’m trying to add a stamina variable, so that when a player is sprinting, that stamina will decrease and stop the user from sprinting when stamina is at 0. Any help with this would be greatly appreciated :smiley:

if ply:KeyDown(IN_SPEED) then
–stamina code

you might also be able to use the lookup command to see what the spirit key is and use isKeyDown()

Alright thank you, but I need a little more help. I’m not sure how to make a variable that tells me if the player is holding the key down or not. I’ve tried to use GM:Move and GM:FinishMove but it doesn’t work as the variable resets. How would I create stamina variable that I could change over time?