-- Important script, don't delete.

local StaminaValue = script.Parent.StaminaValue
local StaminaBarBG = script.Parent.StaminaBarBG
local StaminaBar = StaminaBarBG.StaminaBar
local TweenService = game:GetService("TweenService")

local function updateStaminaBar()
	local StaminaPercent = StaminaValue.Value / 100
	local newBarSize = UDim2.new(StaminaPercent, 0, 1, 0)

	local StaminaTween = TweenService:Create(
		StaminaBar, 
		TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.In),
		{Size = newBarSize}
	)

	StaminaTween:Play()
end

updateStaminaBar()

StaminaValue:GetPropertyChangedSignal("Value"):Connect(updateStaminaBar)
