local function s(s,Z,e,W)s=s/W return(e*s)*s+Z end local function Z(s,Z,e,W)s=s/W return(-e*s)*(s-2)+Z end local function e(W,X,P,c)local b,n,E,o,r,q=tick()Tweens[W]=b r=W.Size.Y.Scale q=X-r n=P=="\073\110"and s or Z E=(game:GetService("\082\117\110\083\101\114\118\105\099\101")).RenderStepped:connect(function()o=tick()-b if Tweens[W]~=b then E:disconnect()return end local s=math.max(.05,n(math.min(c,o),r,q,c))W.Size=UDim2.new(.1,-3,s,0)W.BackgroundColor3=(Color3.new(.7,.3,1)):lerp(Color3.new(.3,1,.7),s/Height)if o>c then E:disconnect()if P~="\073\110"then e(W,.05,"\073\110",.3)end end end)end
-- EASING FUNCTIONS --
local function quadIn(t, b, c, d)
	t = t / d
	return c * t * t + b
end
local function quadOut(t, b, c, d)
	t = t / d
	return -c * t * (t - 2) + b
end
local function Quad(obj, val, ease, d)
	local t, f, con, nt, st, sd = tick()
	Tweens[obj] = t -- Set identifier
	st = obj.Size.Y.Scale -- Start Value
	sd = val - st -- Change in Value
	f = ease == "In" and quadIn or quadOut -- Choose between Out/In
	con = game:GetService("RunService").RenderStepped:connect(function()
		nt = tick() - t
		if Tweens[obj] ~= t then -- Check for override
			con:disconnect()
			return
		end
		local nv = math.max(0.05, f(math.min(d, nt), st, sd, d)) -- New Value
		obj.Size = UDim2.new(0.1, -3, nv, 0)
		obj.BackgroundColor3 = Color3.new(0.7, 0.3, 1):lerp(Color3.new(0.3, 1, 0.7), nv / Height)
		if nt > d then -- Easing done?
			con:disconnect()
			if ease ~= "In" then
				Quad(obj, 0.05, "In", 0.3) -- Drop the bar
			end
		end
	end)
end
