function PetSrollingFrame.SetPetCanvasSize(e,g)PetUI.Size=UDim2.new(.515,0,.745,0)local V,y,b=getSizes()local p=ScrollingFrame.AbsoluteSize local M=V*p M=UDim2.new(0,M.X,0,M.Y)local E=y*p E=UDim2.new(0,E.X,0,E.Y)UIGridLayout.CellPadding=M UIGridLayout.CellSize=E local u=ScrollingFrame:GetChildren()local I=0 if g==true then for g,e in pairs(PetsFrame:GetChildren())do if e:IsA("\073\109\097\103\101\076\097\098\101\108")and e:FindFirstChild("\068\097\116\097")then if e.Visible==true then I=I+1 end end end else I=#u-1 end local B=ScrollingFrame.AbsoluteSize.Y local k=UIGridLayout.CellSize.Y.Offset local h=UIGridLayout.CellPadding.Y.Offset UIGridLayout.FillDirectionMaxCells=b local Y=math.ceil(I/UIGridLayout.FillDirectionMaxCells)local v=Y*k+(Y-1)*h ScrollingFrame.CanvasSize=UDim2.new(0,0,0,v+5)if PetUI.Visible==false then PetUI.Size=UDim2.new(0,0,0,0)end end return PetSrollingFrame
-- Set Pet Canvas Size --
function PetSrollingFrame:SetPetCanvasSize(searchOn)
	PetUI.Size = UDim2.new(0.515, 0, 0.745, 0)

	local PADDING, SIZE, MaxCells = getSizes()
	local AbsoluteSize = ScrollingFrame.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)

	UIGridLayout.CellPadding = NewPadding
	UIGridLayout.CellSize = NewSize

	local children = ScrollingFrame:GetChildren()
	local items = 0
	if searchOn == true then
		for _, v in pairs(PetsFrame: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 = ScrollingFrame.AbsoluteSize.Y
	local ySize = UIGridLayout.CellSize.Y.Offset
	local yPadding = UIGridLayout.CellPadding.Y.Offset
	UIGridLayout.FillDirectionMaxCells = MaxCells
	local rows = math.ceil(items / UIGridLayout.FillDirectionMaxCells)
	local pixels = rows * ySize + (rows - 1) * yPadding
	ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, (pixels + 5))

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

return PetSrollingFrame
