Hi, I'm fairly new to scripting although I know many of the basics. I'd like to create a stamina bar for sprinting. I've figured I'll probably have to use a remote event to stop it from being exploited, but not entirely sure how I'd approach making this. I know how to create the shift to sprint and GUI, it's just the stamina bar depletion/regain (out of 100%) I'm not sure how I'd approach, any help and suggestions would be appreciated.
There are many good tutorials on YouTube for like like this one or this one.
The code below isn't really copy-paste-able, it's just an example.
How to start:
game.Workspace.Player.Humanoid.Running:connect(function(speed) if speed > 16 then print("Player is running") -- decrease stamina bar elseif speed == 16 print("Player is walking") -- increase stamina bar elseif speed == 0 print("Player stopped") end end)
The GUI
You could then take bits from tutorials like this and this to help you make the GUI.
That's how you can start.