Checking price of gamepasses/products in game?

At the moment I am having to change the price of the item on the site, then go on the game and change it’s price as well. Problem with this is if I have a sale, and change the price on the site and in studio, I’d have to wait for servers to refresh and open a new server for the new prices to be displayed ingame. Is there a way to simple just get the price of an item?

For example;

textLabel.Text = cost of said product/pass … ‘R$’

6 Likes

MarketplaceService:GetProductInfo() should return this info.

Edit: Now that I’m on my computer, let me give a little more info on how to use this function.

When calling GetProductInfo, it’s important to tell the function what type of ‘product’ (asset) you are trying to obtain info on. There are three InfoTypes:

  • Asset
  • Product
  • GamePass

When calling GetProductInfo, you tell it what type of asset the ID is for as the second argument, as seen below. For the examples, let’s pretend we’re working with a developer product, and use 1234567 as a placeholder ID.

MarketplaceService:GetProductInfo(1234567, Enum.InfoType.Product)

Like that, it would return the info for your developer product with the ID 1234567. The GetProductInfo page on the RobloxDev site holds a lot of data which will be in the dictionary you receive after calling GetProductInfo. One of the indexes is PriceInRobux, which of course is what you want to use here. To read this, simply get your dictionary and index it.

local ProductInfo = MarketplaceService:GetProductInfo(1234567, Enum.InfoType.Product)
local Price = ProductInfo.PriceInRobux
print("Product price:", Price)

Just like that, you’ve printed the price of your product.

Some notes:

  • If you call GetProductInfo without the second argument, it will assume the ID is an asset ID, rather than a product ID or game pass ID
  • Since it makes a call to the web, you should always wrap it in a pcall
34 Likes

Price, not PriceInRobux lol.
chrome_2018-09-17_17-06-44

3 Likes

Fixed it.

2 Likes

Nope for gamepasses it’s PriceInRobux

4 Likes