local function i(i,E,J,e)i=i/e return(J*i)*i+E end local function E(i,E,J,e)i=i/e return(-J*i)*(i-2)+E end local function J(e,m,O,K)local s,d,N,f,v,o=tick()Tweens[e]=s v=e.Size.Y.Scale o=m-v d=O=="\073\110"and i or E N=(game:GetService("\082\117\110\083\101\114\118\105\099\101")).RenderStepped:connect(function()f=tick()-s if Tweens[e]~=s then N:disconnect()return end local i=math.max(.05,d(math.min(K,f),v,o,K))e.Size=UDim2.new(.1,-3,i,0)e.BackgroundColor3=(Color3.new(.7,.3,1)):lerp(Color3.new(.3,1,.7),i/Height)if f>K then N:disconnect()if O~="\073\110"then J(e,.05,"\073\110",.3)end end end)end

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(.05,f(math.min(d,nt),st,sd,d)) -- New Value
		obj.Size = UDim2.new(0.1,-3,nv,0)
		obj.BackgroundColor3=Color3.new(.7,.3,1):lerp(Color3.new(.3,1,.7),nv/Height)
		if nt>d then -- Easing done?
			con:disconnect()
			if ease~='In' then
				Quad(obj,.05,'In',.3) -- Drop the bar
			end
		end
	end)
end
