How do I change this run script into a stamina script?

Please read the following post, How can I make a stamina bar that works with my sprint script?