Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you check if shirt is valid with the Id given?

Asked by
Mineloxer 187
6 years ago

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?

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. mattscy 3725 — 6y
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) Mineloxer 187 — 6y

Answer this question