{HELP} PriceInRobux Issue nil

I made this very short code:

local IDT = "226217449"

print(IDT.PriceInRobux)

For print the price of robux of the ID of the asset and it says " nil "

image

1 Like

Is that ID a gamepass or what?

Its a shirt random that I get from the catalog

Try this:

local Id = 226217449

local MarketplaceService = game:GetService("MarketplaceService")

print(MarketplaceService:GetProductInfo(Id,Enum.InfoType.Asset).PriceInRobux)

You need the GetProductInfo function to get the price of the asset, More info here

Because PriceInRobux does not exist in string

If you want specifically, do

local Id = 226217449

print(game.MarketplaceService:GetProductInfo(Id,Enum.InfoType.Asset).PriceInRobux)

This is the same as:

You should both wrap the code inside a call to pcall() too.

2 Likes

Ok

local Id = 226217449
local priceinrobux
local suc,er = pcall(function()
     priceinrobux = game.MarketplaceService:GetProductInfo(Id,Enum.AssetType.Asset).PriceInRobux
end)
if suc then
print(priceinrobux)
end

Doesn’t works… It just doesn’t print it…

Works ! Thanks you alot !!! <3 <3 <3