-- Walking --

local function Walk(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		Running = false
		humanoid.WalkSpeed = 16

		while not Running and Stamina2.MinValue < 550 do
			Stamina2.MinValue += 2	
			StamBar.Size = UDim2.new(0, Stamina2.MinValue, 0, 15)		
			wait(.1)
		end

	end
end
UIS.InputEnded:Connect(Walk)

while true do
	wait(.01)
	StamBar.Size = UDim2.new(0, Stamina2.MinValue, 0, 15)	

	if Stamina2.MinValue >= 180 then

		local Goal = {BackgroundColor3 = Color3.new(0.258824, 0.756863, 0.0470588)}
		--Set the tween:
		local Tween = TweenService:Create(StamBar, TweenInfo.new(2), Goal)
		Tween:Play()
	end

	-- if stamina is below 150 then color is yellow
	if Stamina2.MinValue <= 150 then

		local Goal = {BackgroundColor3 = Color3.new(0.772549, 0.772549, 0)}
		--Set the tween:
		local Tween = TweenService:Create(StamBar, TweenInfo.new(2), Goal)
		Tween:Play()
	end

	-- if stamina is below 50 then color is red
	if Stamina2.MinValue <= 70 then

		local Goal = {BackgroundColor3 = Color3.new(0.772549, 0, 0.0117647)}
		--Set the tween:
		local Tween = TweenService:Create(StamBar, TweenInfo.new(2), Goal)
		Tween:Play()
	end
end
