First, place down a property called “Stamina.” Make it’s property type number and the scope should be player. The starting value should also be 0. Now place down an inventory item manager that tracks the property “Stamina.” Make the item the item inventory manager manages to energy, (or whatever your player uses to move.)
Next make sure that there isn’t an item alert.
Now place down a movement meter with tracked item to energy, (or whatever your player uses to move.) Now make item drain per tick (whatever), and drain interval, (whatever.)
Now place down a lifecycle with no settings changed, and a repeater. Make the task interval in the repeater the same as your movement meters drain interval. Now make it so that the repeater stops when receiving on a channel. Now wire the lifecycle to the repeater so that event occurs, start repeater. Now place down a trigger with the following block code:
This block code shows when a player reaches a certain energy amount, they will be slowed down. Change this depending on when you want or how often you want your players to slow down. Now wire the repeater to the trigger so that task occurs, trigger. Now place down some speed modifiers based on how often your player will be slowed down.
Now go into your speed modifers and make it so that they will each set your players to the configured speed when receiving on their respective channels.
And there you go! a working stamina system, but there is a limit to speed modifiers, and i don’t think this would work that well if your player has an absurd amount of energy.
There is probably a more efficient way to do this, so this is most likely not the best way.