Sprinting and stamina?

its not counting down at all, because your subtraction code is called only once, when the player presses the key. what you should have, is the key press sets a boolean to true, and key release sets a boolean to false, and every Tick, it checks the boolean, to decide whether to add or subtract from stamina.

eventually, you will want to replace the boolean with an Enum of various running states, so you can decide if the player is allowed to run. you could have the enum include things like walk, run, tired, poisoned, injured, crawling, climbing, inAMenu, etc… and in alot of those modes, the player will not be allowed to run. also, eventually, you might want to replace the tick code with a timer, because you probably don’t need to update stamina every frame, you could update it every few frames, and the player wont notice the difference.