I'm not too sure what I have missed, but there is something as you can still Sprint when Stamina has fallen into the Negatives.
local mouse = game.Players.LocalPlayer:GetMouse()
local player = game.Players.LocalPlayer
running = false
local function onKeyDown( key )
print("Key:", key, " Code:", string.byte(key))
if string.byte(key) == 48 and script.Parent.Stamina.Value > 0 and running == false then
hum = player.Character.Humanoid
hum.WalkSpeed = 25
script.Parent.Stamina.Value = script.Parent.Stamina.Value - 1
script.Parent.Size = script.Parent.Size - UDim2.new(0,2,0,0)
running = true
while running == true do
script.Parent.Stamina.Value = script.Parent.Stamina.Value - 5
script.Parent.Size = script.Parent.Size - UDim2.new(0,2,0,0)
wait(0.1)
end
else
hum = player.Character.Humanoid
hum.WalkSpeed = 16
running = false
end
end
mouse.KeyDown:connect(onKeyDown)

3 comments
Edit: uncommented the lines for your gui size. I did not use a gui for testing so i commented them out.
Heh, thanks for pointing that out.
No problem.