Hello! I have recently spent a while creating a movement system for my game. One essential aspect is a stamina system. After managing to create the whole running and draining stamina system with my very limited scripting skills, I was happy that everything worked. However, the last thing I needed to add was a way to regain stamina when your weren’t running. I thought this would be easy but it literally will not work. I can get the stamina to go up when you are walking or not moving, but it just keeps going up. I have set max stamina at 500 and it just goes beyond that every time. I do not know what to do anymore and cannot really find any videos on what I need. Can someone please help/guide me at least.
Here is the place where I am trying to script the regaining of stamina. It is inside of a local script which is inside the stamina bar gui. Fyi, stamina is an “int value” inside of the player.