PriceInRobux not working on shirts

Im trying to get the price of a shirt so i tried using MarketPlaceService but it always returns nil

Whenever i just put in the id then it works fine

local ShirtInfo = game:GetService("MarketplaceService"):GetProductInfo(756245568)
print(ShirtInfo.PriceInRobux) -- 8

But when i try to get just a shirt id thats when the problem starts when i try to get the id from a shirt

local ShirtInfo = game:GetService("MarketplaceService"):GetProductInfo(tonumber(string.sub(CurrentItem.ShirtTemplate,14)) or tonumber(string.sub(CurrentItem.ShirtTemplate,33))) 
print(ShirtInfo.PriceInRobux) -- returns nil

1 Like

Try passing the Asset InfoType as the second argument.

local ShirtInfo = game:GetService("MarketplaceService"):GetProductInfo(tonumber(string.sub(CurrentItem.ShirtTemplate,14)) or tonumber(string.sub(CurrentItem.ShirtTemplate,Enum.InfoType.Asset))) 

I have tried using that before but it just returned both as nil

Turns out for some reason rather than just getting the price of the shirt it would go to the texture which wasnt on sale

Heres the id of the actual shirt

and here the id changes to the texture

Now im not sure how i can get the actual shirt id and not the texture

Roblox uploads two assets when you upload clothing: one is used to preview the asset as a item info page on the site and the other is the actually rendered texture. You can’t get a Shirt from a ShirtTemplate so you need to store both somewhere. Use the Shirt id when working with MarketplaceService features and the ShirtTemplate to render it via Shirt objects.

Also, protip for getting the ShirtTemplate id: this is a lot cleaner and arbitrary than sub:

tonumber(CurrentItem.ShirtTemplate:match("^%d+"))
2 Likes