(Note: filtering enabled is on)
(Note: no errors in output)

-- LOCALSCRIPT

local player  = game.Players.LocalPlayer
repeat wait() until player.Character
local char = player.Character
local hum = char:WaitForChild('Humanoid')
local staminabar = script.Parent
local maxstamina = 100
local minstamina = 0
local frame = script.Parent
local stamina = script.Parent:WaitForChild('Stamina')
local textlabel = script.parent:WaitForChild('TextLabel')
local userInput = game:GetService('UserInputService')

local canSprint = true
local Sprinting = false


userInput.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		if stamina.Value > 0 then
			hum.WalkSpeed = 20
			while stamina.Value > 0 do
				frame:TweenSize(UDim2.new(stamina.Value * 0, 2.5, 0, 10), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 1)
				stamina.Value = stamina.Value - 1
				wait(1)
			end
			if stamina.Value == 0 then
				hum.WalkSpeed = 16
				repeat wait() until stamina.Value > 0
			end
		end
	end
end)

userInput.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		if stamina.Value == 0 then
			while stamina.Value == 0 do
				frame:TweenSize(UDim.new(stamina.Value * 0, -2.5, 0, 10), Enum.EasingDirection.Out, Enum.EasingDirection.Sine, 1)
				stamina.Value = stamina.Value + 1
				wait(1)
			end
		end
	end
end)