How can I loop through all of the user’s t-shirts that they put up for sale, and display them on a Gui?

Hello! I want to make a game where players can get a stand and then it will display their shirts on a Gui for people to purchase. Is there a way to do this? I want it to be kind-of like Pls Donate’s system https://www.roblox.com/games/8737602449/PLS-DONATE-NEW?gameSetTypeId=100000003&homePageSessionInfo=806f375e-74c0-4f26-996b-e371a0d70095&isAd=false&numberOfLoadedTiles=6&page=homePage&placeId=8737602449&position=0&sortPos=0&universeId=3317679266

This question’s been asked a good number of times recently, try seeing if any of those threads provide you an answer. Here’s a recent one:

1 Like

I know, NONE of them say how to put it on a Gui

You need to take the data you receive, then loop through that data and create the UI from there.

Something like this:

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

Make sure to check what the table that is returned looks like, that’s what will help you set up the UI as well.

1 Like

Cool! thanks! One more thing, were should I put the script? I’m assuming Starter Gui, is this correct?

okay so in the thread given by @colbert2677, in the thread. there is the function getUserGeneratedTShirtsRecursive witch give u all of the AssetId’s from the Catlog. my best guess is you can use MarketPlaceService:GetProductInfo() to get the product info. so you can loop thorugh all those id’s given by that table and check if its on sale or not witch is provided by the GetProductInfo look in the docs for the information you can use with the marketplaceservice funciton.

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?