How do i make a Gui from a tabel (Explained more Bellow)

Hello, basically, I want to make something like in PLS Donate, where people can set up stands and have people dentate to them, I have the code to search the players Inventory for shirts:

local http = game:GetService("HttpService")

local baseUrl = "https://catalog.roproxy.com/v1/search/items/details?Category=3&Subcategory=13&Limit=30&CreatorName=%s&cursor=%s"

local function getUserGeneratedTShirtsRecursive(username, tshirts, cursor)
	tshirts = tshirts or {}
	cursor = cursor or ""
	local requestUrl = baseUrl:format(username, cursor)
	local success, result = pcall(function()
		return http:GetAsync(requestUrl)
	end)
	
	if success then
		if result then
			local success2, result2 = pcall(function()
				return http:JSONDecode(result)
			end)
			
			if success2 then
				if result2 then
					for _, tshirt in ipairs(result2.data) do
						table.insert(tshirts, tshirt.id)
					end
					
					cursor = result2.nextPageCursor
					if cursor then
						return getUserGeneratedTShirtsRecursive(username, tshirts, cursor)
					else
						return tshirts
					end
				end
			else
				warn(result)
			end
		end
	else
		warn(result)
	end
end

local username = "Roblox"
local userTShirts = getUserGeneratedTShirtsRecursive(username)
print(#userTShirts) --3
print(table.concat(userTShirts, " ")) --1031862 1036727 1031864

How would I take this data and put all of the product ids into a different Gui. (One Gui for each product) Also how would I each product Id into a different number value?
Sorry If this didn’t make sense when you read it
Thanks, Mason

You can create a button with a script and an intvalue, and loop thru the usertshirts, creating a clone of the button, putting the id into the intvalue, and in the script u can make it so when you press the button it takes the id from the intvalue.

I would use this to loop through the shirts right?

for i, v in pairs(TShirtData) do
    -- Add code here
end

Yes, tshirtdata has to be the table of the tshirt ids, and the rest is simple, just clone the button and put the id into it.

The code i used: local tableTS = table.insert(userTShirts, " ") for i, v in pairs(tableTS) do print(tableTS) end
It says: ServerScriptService.GameSystems.DonateGui:46: invalid argument #1 to ‘pairs’ (table expected, got nil)

You could just use the usertshirts table in the loop, also first argument of table.insert is the table in which you want to insert the value, and second argument is the value itself. Also when printing the values in the table print the v, since i is the index of the value(position in the table) while v is the value in that index.

I don’t see a usertshirts table. where is it?

Sorry, I have so many questions, am a builder not a scripter.

userTShirts is the table from which you printed the ids with table.concat so you can use it for this loop.

I have updated the code:

game.Players.PlayerAdded:Connect(function(plr)
	local baseUrl = "https://catalog.roproxy.com/v1/search/items/details?Category=3&Subcategory=13&Limit=30&CreatorName=%s&cursor=%s"

	local function getUserGeneratedTShirtsRecursive(username, tshirts, cursor)
	tshirts = tshirts or {}
	cursor = cursor or ""
	local requestUrl = baseUrl:format(username, cursor)
	local success, result = pcall(function()
		return http:GetAsync(requestUrl)
	end)

	if success then
		if result then
			local success2, result2 = pcall(function()
				return http:JSONDecode(result)
			end)

			if success2 then
				if result2 then
					for _, tshirt in ipairs(result2.data) do
						table.insert(tshirts, tshirt.id)
					end

					cursor = result2.nextPageCursor
					if cursor then
						return getUserGeneratedTShirtsRecursive(username, tshirts, cursor)
					else
						return tshirts
					end
				end
			else
				warn(result)
			end
		end
	else
		warn(result)
	end
end

local username = plr.Name
local userTShirts = getUserGeneratedTShirtsRecursive(username)
print(#userTShirts) --3
print(table.concat(userTShirts, " ")) 


for i, v in pairs(userTShirts) do
		local Template = script.Template:Clone()
		Template.Parent = game.Workspace.Map.Booths:WaitForChild(plr.UserId):WaitForChild("DonateSign"):WaitForChild("SurfaceGui"):WaitForChild("Frame")
		local MarketplaceService = game:GetService("MarketplaceService")
		Template.Id.Value = table.concat(userTShirts, " ")
end


end)

I got it to make the Gui, but when I try to put the product Id's into the values, it keeps the value at zero. Is there a way to fix this?

table.concat prints whole table as a string, instead write Template.Id.Value = v, since v is the id.