PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

PromptGamePassPurchaseFinished

This event fires when a purchase dialogue of a game pass is closed. This fires right as the dialogue closes when the player presses “Cancel” at the prompt, or “OK” at the success/error message.

  • For developer product purchase prompts, connect to
    MarketplaceService/PromptProductPurchaseFinished. In order to
    process such purchases you need to set the
    MarketplaceService/ProcessReceipt|ProcessReceipt callback in a
    single script.

  • For affiliate gear sales or other assets, use
    MarketplaceService/PromptPurchaseFinished.

Parameters

Name Type Default Description

The Player object for whom the prompt was shown

The ID number of the game pass shown in the prompt (not to be confused with an asset ID)

Whether the item was successfully purchased (false for errors and cancellations)


Code Samples


Handling Gamepass Purchase Finished

Below is a screenshot of a game pass purchase prompt. The function in the code sample runs immediately after the player presses “Cancel” or after the player buys the game pass then presses “OK”. Should there be an issue with the purchase, the event also fires.

A game pass purchase prompt

local MarketplaceService = game:GetService("MarketplaceService")

local function gamepassPurchaseFinished(...)
	-- Print all the details of the prompt, for example:
	-- PromptGamePassPurchaseFinished PlayerName 123456 false
	print("PromptGamePassPurchaseFinished", ...)
end

MarketplaceService.PromptGamePassPurchaseFinished:Connect(gamepassPurchaseFinished)