I have an Id, and I want to check if there is a shirt with the corresponding Id in the catalog. This is what I have, but it doesn't seem to work:

local function ValidShirt(shirtId)
	--//Check whether shirt id is valid
	local success, returned = pcall(function()
		local asset = marketplaceService:GetProductInfo(shirtId, Enum.InfoType.Asset)
		
		--//Return asset
		return asset
	end)
	
	--//No errors
	if success then
		--//Check if returned asset is a shirt
		return (returned.AssetTypeId == Enum.AssetType.Shirt)
	end
end

Any solutions?

2 comments

0

It may not result in an error if it cant get the product info. Try printing the returned variable after giving it a false id to see what it is.

0

I have worked around abit and got it to work, except, now everytime I try to load a new shirt Id instead of the current one, it fails to load and says "Request failed" or it doesn't error but the player is naked(Even tho the Id was a correct one)