FiveM provides "Natives"—built-in functions—that allow scripts to interact with the game engine. The most critical native for this task is RestorePlayerStamina . A basic implementation in Lua looks like this:
Running approximately every 190 yards (175 meters) increases your stamina skill by 1%. fivem infinite stamina
While "FiveM Infinite Stamina" scripts are simple, they can impact your server if not handled correctly: Stamina System Feedback - Code Review - Developer Forum fivem infinite stamina