This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts.
This function provides information about an asset, developer product or game pass given its assetId and the
Enum/InfoType (Asset, Product or GamePass respectively).
Information about the queried item is provided in a dictionary with the following keys. Note that not all information is provided or necessarily relevant for the kind of object you are querying.
|string||The name shown on the asset's page|
|string||The description as shown on the asset's page; can be nil if blank|
|number||The cost of purchasing the asset using Robux|
|timestamp||Timestamp of when the asset was created, e.g. |
|timestamp||Timestamp of when the asset was last updated by its creator, e.g. |
|number||Indicates whether the item is marked as 13+ in catalog|
|number||The minimum Builder's Club subscription necessary to purchase the item|
|boolean||Describes whether the asset can be taken for free|
|Dictionary||A table of information describing the creator of the asset (see following lines)|
|number||The ID of the creator user or group|
|string||The name/username of the creator|
|number||(Use CreatorTargetId instead)|
|number||If InfoType was Asset, this is the ID of the given asset.|
|number||The type of asset (e.g. place, model, shirt)*|
|boolean||Describes whether the asset is purchasable|
|boolean||Describes whether the asset is a "limited item" that is no longer (if ever) sold|
|boolean||Describes whether the asset is a "limited unique" ("Limited U") item that only has a fixed number sold|
|boolean||Describes whether the asset is marked as "new" in the catalog|
|number||The remaining number of items a limited unique item may be sold|
|number||The number of items the asset has been sold|
|number||If the InfoType was Product, this is the product ID|
|number||For developer products, this is the asset ID of the product's icon (or 0 if the product does not have one)|
articles/Asset types|Asset Types for the asset type ID numbers.
†Timestamps are formatted using ISO 8601
Developer Product Example
The following example loads information about a developer product.
local PRODUCT_ID = 336755544 local MarketplaceService = game:GetService("MarketplaceService") local productInfo = MarketplaceService:GetProductInfo(PRODUCT_ID, Enum.InfoType.Product) print("Product ID " .. PRODUCT_ID .. " name: " .. productInfo.Name) if productInfo.Description then print("Description: " .. productInfo.Description) else print("No description!") end if productInfo.IsForSale then print("It is on sale for " .. productInfo.PriceInRobux .. " Robux.") end print("The image icon is: rbxassetid://" .. productInfo.IconImageAssetId)
Use in Studio Plugins
This method is often used by plugins to detect old versions and notify the user to manually update a plugin. The plugin author uploads a dummy asset, such as a decal or model, then puts the present version of the plugin in that asset’s description. The plugin then calls this method and checks an internal version number for a newer version.
If no such item exists with the given ID, this function will throw an error:
- For developer products, the error is:
MarketplaceService:getProductInfo() failed because rawProductInfo was empty
- For game passes and assets, the error is:
MarketplaceService:getProductInfo() failed because HTTP 0 (HTTP 400 (HTTP/1.1 400 BadRequest))
The assetId of the specified product
A dictionary containing information about the queried item (described in the table above). Note that not all information is provided or necessarily relevant for the kind of object you are querying
Getting Product Info
The below example will print the name and description of the asset with an ID of 125378389. In this case it will print: “Mr. Fancy Top Hat :: So fancy that even his top hat’s top hat has a top hat.”