I found a bug that makes sprint bar go negative and still allow player to sprint. How can I remove that?
while wait() do
if enabled.Value == true then
if humanoid then
if humanoid.MoveDirection == Vector3.new(0,0,0) then moving = false else moving = true end
if tired then
ChangeSpeed(exhaust.Value) -- Rest
Frame.Rest1.Visible = true
if not moving then
stamina = stamina + 2
end
if stamina > 0 then
tired = false
Frame.Rest1.Visible = false
Frame.GreenBar:TweenSize(UDim2.new(3.5*stamina/875,0, 0,12), "Out", "Quad", 0.1, true)
end
elseif running == true then
if moving then
ChangeSpeed(run.Value) -- Sprint
stamina = stamina - 2
Frame.GreenBar:TweenSize(UDim2.new(3.5*stamina/875,0, 0,12), "Out", "Quad", 0.1, true)
if stamina == 0 then tired = true stamina = -10 end -- i think this is the culprit, but I don't know a work around it.
elseif stamina < 250 then
stamina = stamina + 1
Frame.GreenBar:TweenSize(UDim2.new(3.5*stamina/875,0, 0,12), "Out", "Quad", 0.1, true)
end
else ChangeSpeed(walk.Value) -- Walk
if moving and stamina < 250 then
stamina = stamina + 1
Frame.GreenBar:TweenSize(UDim2.new(3.5*stamina/875,0, 0,12), "Out", "Quad", 0.1, true)
elseif not moving and stamina < 250 then
stamina = stamina + 1
Frame.GreenBar:TweenSize(UDim2.new(3.5*stamina/875,0, 0,12), "Out", "Quad", 0.1, true)
elseif moving and stamina >0 then --I added this, but still not working
tired = true
end
end
end
end
end

2 comments
Heh
;)