So I was wondering how I could make regening stamina for my gladiator game. And this is my script --

local c = game.Players.LocalPlayer.Character
local hum = c:WaitForChild("Humanoid")


while true do
	wait(.1)
	if hum.MoveDirection.Magnitude > 0 then
		for i = 1,10 do
			wait(.5)
			S.Value = S.Value + 10
		end
	end
end

and so I cam to yall, wondering if you could help me find a more efficient way. Thanks