PromptPurchase
Method
PromptPurchase prompts the player to buy a Gamepass or Developer Product when a button is clicked.
Overview
The PromptPurchase Method connects a button (TextButton or ImageButton) to Roblox's MarketplaceService. When clicked, it opens the native purchase prompt for either a Gamepass or a Developer Product.
Setup
- Add the
UiUtilstag on yourTextButtonorImageButton - Add Attribute
Method=PromptPurchase - Add Attribute
Idwith the Gamepass or Product ID - Add Attribute
PurchaseTypewith eitherGamepassorProduct
Attributes
| Attribute | Type | Required | Description |
|---|---|---|---|
Id |
Number | Yes | The ID of the Gamepass or Developer Product |
PurchaseType |
String | Yes | Either Gamepass or Product |
Examples
Prompt a Gamepass purchase:
- Tag:
UiUtils Method=PromptPurchaseId=123456789PurchaseType=Gamepass
Prompt a Developer Product purchase:
- Tag:
UiUtils Method=PromptPurchaseId=987654321PurchaseType=Product
Notes
- The instance must be a
TextButtonorImageButton Idmust be a valid number — you can find it on the Gamepass/Product page on RobloxPurchaseTypemust be exactlyGamepassorProduct(case-sensitive)- The connection is automatically cleaned up when the button is destroyed
- If
Idis missing:No Id found in attributes - If
Idisn't a number:Your id need to be a number - If
PurchaseTypeis missing:No PruchaseType found in attributes