How can I get product price from its id?

Hi,
I need to know how to get gamepass or developer product price in robux by its id because I’m doing a “robux spent” leaderboard for my game.

For example:

-- function getProductPriceByItsId() is what I want to get
getProductPriceByItsId(14372929) --> returns 10

You can use the GetProductInfo method of MarketplaceService

local function getDevProductInfo(productID)
    return game:GetService("MarketplaceService"):GetProductInfo(productID, Enum.InfoType.Product)
end

local someInfo = getDevProductInfo(0)
print(someInfo.PriceInRobux)

For a complete list of fields included in the returned info object, view the documentation here:
https://create.roblox.com/docs/reference/engine/classes/MarketplaceService#GetProductInfo

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.