Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does getproductinfo not work anymore ? is it deprecated


lol = game:GetService("MarketplaceService"):GetProductInfo(6457037)

print(lol.PriceInRobux)

Why does it print nil?

1 answer

✓ Accepted answer

It's not deprecated.

Your error is that the asset you are trying to get PriceInRobux of, is not on sale, it doesn't have a price, that's why it returns Nil.

For others who might have similar issue:

You need to do MarketplaceService:GetProductInfo(PRODUCT_ID, Enum.InfoType.Product)

Basically, you need to specify the type too, unless the type is asset, then it's the default, but if it's product, what normally people want to get info about, you need to specify it.

For more info look here: https://developer.roblox.com/en-us/api-reference/function/MarketplaceService/GetProductInfo

If you are too lazy to look:

lol = game:GetService("MarketplaceService"):GetProductInfo(6457037, Enum.InfoType.Product)

print(lol.PriceInRobux)

You can use these types: Enum.InfoType.Asset(The Default), Enum.InfoType.Product, and Enum.InfoType.GamePass

3 comments

0

Nvermind, the thing you wanted to get info about, is asset, so it should work, any errors on your script?

0

no, it just prints nil

0

Ok, I found out why, it's because the asset you are trying to get info of, it is not on sale, so you can't get the price, there is no price.

This discussion is preserved as it was. New answers, comments, and votes are closed.