How do i make infinitivly scrolling frame

Im using a UI Grid Layout with a inventory loading system

What I have tried doing

local function updateInventoryFrameSize()
	local absoluteSize = UiGridLayout.AbsoluteContentSize
	local padding = 10 -- Add some padding to the content size
	inventoryFrame.CanvasSize = UDim2.new(0, absoluteSize.X + padding, 0, absoluteSize.Y + padding)
end


local function pagesToTable(pages, assetTypesVariable)
	local allItems = {}  -- Initialize an empty table to hold all items

	while true do
		if pages.IsFinished then
			for _, UIObject in pairs(Inventory:GetChildren()) do
				if UIObject and UIObject:IsA("ImageButton") then
					UIObject:Destroy()
				end
			end

			if currentPageNumber >= #items and currentPageNumber ~= #items then
				print("Impossible")
			end
			local currentPage = currentPageNumber

			-- Iterate over each page and concatenate its items into allItems
			for _, pageItems in ipairs(items) do
				for _, item in ipairs(pageItems) do
					table.insert(allItems, item)  -- Concatenate items into allItems
				end
			end

			-- Now allItems contains all the items from all pages

			break
		end
		pages:AdvanceToNextPageAsync()
		table.insert(items, pages:GetCurrentPage())
	end

	for _,item in pairs(allItems) do
		task.wait(0.05)
		creation(item, assetTypesVariable)
	end

	-- Update the size of the inventory frame after all items are created
	updateInventoryFrameSize()
end

Result

image
Just really stretched out images and not infinitivly scrollable.

1 Like