How can I check what type of ID I have entered?

Hello,

So I was recently commissioned to code a donation sign thing where you can add a gamepass, T-shirt, Shirts or Pants. So I was thinking about using the marketplaceservice function of :GetProductInfo but I am really confused about how to work this. I believe it requires whatever the ID is in a code thing but I am not sure how I can check to see what ID it links to.

Anyone got any ideas?

What I was sent by the user who asked me to create the sign as an example:

https://developer.roblox.com/en-us/api-reference/function/MarketplaceService/GetProductInfo

Like I said I attempted to use this market place service function but really does not work out for me.

I thought the “AssetTypeId” that we get when using this would give an ID for a game pass but after trying this with different game passes I got 2-3 different IDs. Got any idea why?

local marketplace = game:GetService("MarketplaceService")

local success, result = pcall(function()
	return marketplace:GetProductInfo(129459077)
end)

if success then
	if result then
		if result.AssetTypeId == 2 then
			print("T-Shirt!")
		elseif result.AssetTypeId == 11 then
			print("Shirt!")
		elseif result.AssetTypeId == 12 then
			print("Pants!")
		end
	end
else
	warn(result)
end

To clarify, “Pants!” was printed in the above example.

Here are the asset type enumerations:
https://developer.roblox.com/en-us/api-reference/enum/AssetType

I checked this out and for game passes I got 2 different IDS when I tried 2 different game passes which to me makes 0 sense not one from that list.

On the list thing you linked in your post it says gamepass AssetTypeId should be “34”
Gamepass One:

image

Gamepass Two:

image

AssetId is the asset’s unique ID, AssetTypeId describes the asset type, 2 for t-shirt, 11 for shirt, 12 for pants, 34 for gamepass etc.

https://www.roblox.com/games/6240746/Rayce69s-Place
https://www.roblox.com/library/3665174/200486a

Neither of those IDs correspond to gamepasses.

In fact they correspond to their correct asset IDs, a place & an image respectively (9 & 1).

Wait so am I getting confused on what an asset Id is then? I thought it was this thing in the URL.

That’s a gamepass ID not an asset ID.

How can I convert this gamepass ID to asset ID then?

What do you need their asset IDs for? You already know that they’re gamepasses.

local marketplace = game:GetService("MarketplaceService")

local success, result = pcall(function()
	return marketplace:GetProductInfo(6240746, Enum.InfoType.GamePass)
end)

if success then
	if result then
		--Do code.
	end
else
	warn(result)
end

If you want to use GetProductInfo() to fetch information about them then you need to pass an optional “InfoType” Enum argument to it.

Only legacy gamepasses use the old asset ID system, newer gamepasses use the current gamepass ID system instead.

The person that hired me to do this wants them to be able to add either a T-shirt, Shirt, Pants or GamePass as I showed on the image above so it will not know what it is so I need to check to see what the ID they put in is.
image

They’ll need an additional textbox to differentiate between clothing & gamepasses.

Unless you’re willing to go down the route of HttpService web scraping.

1 Like

Ignore this post, it has been redacted.

Is there anyway we can get the shirt image as an example?

image

rbxthumb://type=Asset&id={idhere}&w=420&h=420