I get a players gamepasses but it just switches to game id?

So my script returns a players gamepasses, but I have an issue where I use print statements to check what it’s returning and its definitely gamepass id’s. However in my next part of code it checks what type of data it is and it says its a game id? Even thought I checked just before and it is a gamepass id.

Prints gamepass id’s:

                   for i = num, 1 , -1 do
						print(userGamepasses[i])
					end

Prints “9” which stands for place id:

local Asset = MarketPlaceService:GetProductInfo(userTShirts[i])
						local assetPrice = nil
						local assetId = nil
						
						if Asset.AssetTypeId == 2 then
							print("Tshirt")
							assetPrice = Asset.PriceInRobux
							assetId = Asset.AssetId
						elseif Asset.AssetTypeId == 34 then
							print("Gamepass")
							assetPrice = Asset.PriceInRobux
							assetId = userTShirts[i]
						elseif Asset.AssetTypeId == 1 then
							assetPrice = Asset.PriceInRobux
							assetId = Asset.AssetId
						else
							print(Asset.AssetTypeId)
							print("Not in category")
						end

Whole code:

                   local UrlB = "https://www.roproxy.com/users/inventory/list-json?assetTypeId=34&cursor=&itemsPerPage=100&pageNumber=%s&userId=%s"

					local function getUserCreatedGamepassesRecursive(userId, SignPrices, gamepasses, pageNumber, lastLength)
						gamepasses = {}
						pageNumber = pageNumber or 1
						lastLength = lastLength or math.huge

						local requestUrl = UrlB:format(pageNumber, userId)
						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 _, gamepass in ipairs(result2.Data.Items) do
											if gamepass.Creator.Id == userId and table.find(gamepasses, gamepass.Item.AssetId) == nil then
												table.insert(gamepasses, gamepass.Item.AssetId)
											end
										end
									else
										warn(result)
										getUserCreatedGamepassesRecursive(userId, gamepasses, pageNumber, lastLength)
									end
								end
							else
								warn(result)
								getUserCreatedGamepassesRecursive(userId, gamepasses, pageNumber, lastLength)
							end
							return gamepasses
						end
					end  
					
					local userTShirts = GetUserGeneratedTShirts(winnerId, 10)
					local userGamepasses = getUserCreatedGamepassesRecursive(winnerId)
					local num = (#userGamepasses)
					
					for i = num, 1 , -1 do
						print(userGamepasses[i])
					end
					
					table.move(userGamepasses, 1, #userGamepasses, #userTShirts + 1, userTShirts)
					
					num = (#userTShirts)

					local table1 = {}

					for i = num, 1, -1 do
						local Asset = MarketPlaceService:GetProductInfo(userTShirts[i])
						local assetPrice = nil
						local assetId = nil
						
						if Asset.AssetTypeId == 2 then
							print("Tshirt")
							assetPrice = Asset.PriceInRobux
							assetId = Asset.AssetId
						elseif Asset.AssetTypeId == 34 then
							print("Gamepass")
							assetPrice = Asset.PriceInRobux
							assetId = userTShirts[i]
						elseif Asset.AssetTypeId == 1 then
							assetPrice = Asset.PriceInRobux
							assetId = Asset.AssetId
						else
							print(Asset.AssetTypeId)
							print("Not in category")
						end

Output:
Screenshot 2024-03-11 165631

I’d really appreciate any help I’ve been stuck on this for ages, thanks :slight_smile:

1 Like

Is it something to do with the the roproxy im using?

1 Like