function PetSrollingFrame.SetPetCanvasSize(d,Y,u)local R=Y.UIGridLayout TradeMenuUI.Size=UDim2.new(.55,0,.925,0)local T,n,P=getPetSizes()local J=Y.AbsoluteSize local j=T*J j=UDim2.new(0,j.X,0,j.Y)local h=n*J h=UDim2.new(0,h.X,0,h.Y)R.CellPadding=j R.CellSize=h local W=Y:GetChildren()local l=0 if u==true then for Y,u in pairs(Y:GetChildren())do if u:IsA("\073\109\097\103\101\076\097\098\101\108")and u:FindFirstChild("\068\097\116\097")then if u.Visible==true then l=l+1 end end end else l=#W-1 end local c=Y.AbsoluteSize.Y local C=R.CellSize.Y.Offset local N=R.CellPadding.Y.Offset R.FillDirectionMaxCells=P local a=math.ceil(l/R.FillDirectionMaxCells)local D=a*C+(a-1)*N Y.CanvasSize=UDim2.new(0,0,0,D+5)if TradeMenuUI.Visible==false then TradeMenuUI.Size=UDim2.new(0,0,0,0)end end return PetSrollingFrame

function PetSrollingFrame:SetPetCanvasSize(Frame, searchOn)
	local UIGridLayout2 = Frame.UIGridLayout
	
	TradeMenuUI.Size = UDim2.new(0.55, 0, 0.925, 0)

	local PADDING, SIZE, MaxCells = getPetSizes()
	local AbsoluteSize = Frame.AbsoluteSize

	local NewPadding = PADDING * AbsoluteSize
	NewPadding = UDim2.new(0, NewPadding.X, 0, NewPadding.Y)
	local NewSize = SIZE * AbsoluteSize
	NewSize = UDim2.new(0, NewSize.X, 0, NewSize.Y)

	UIGridLayout2.CellPadding = NewPadding
	UIGridLayout2.CellSize = NewSize

	local children = Frame:GetChildren()
	local items = 0
	if searchOn == true then
		for _, v in pairs(Frame:GetChildren()) do
			if v:IsA("ImageLabel") and v:FindFirstChild("Data") then
				if v.Visible == true then
					items = items + 1
				end
			end
		end
	else
		items = (#children) - 1
	end
	local frameSizeY = Frame.AbsoluteSize.Y
	local ySize = UIGridLayout2.CellSize.Y.Offset
	local yPadding = UIGridLayout2.CellPadding.Y.Offset
	UIGridLayout2.FillDirectionMaxCells = MaxCells
	local rows = math.ceil(items / UIGridLayout2.FillDirectionMaxCells)
	local pixels = rows * ySize + (rows - 1) * yPadding
	Frame.CanvasSize = UDim2.new(0, 0, 0, (pixels + 5))

	if TradeMenuUI.Visible == false then
		TradeMenuUI.Size = UDim2.new(0, 0, 0, 0)
	end
end

return PetSrollingFrame
