How to know when the player clicks on the roblox devproduct okay button

Hey, I want to play a chest animation after the player clicks on the dev products okay button not when the devproduct is done successfully because the UI will cover the chest animation and it won’t look good.

It is deprecated so I don’t recommend using it, however .PromptProductPurchaseFinished is the only way to do this AFAIK.

Can you give me code? Is the parameter that is passed like recieptInfo?

Also it says do not use it for devproduct processing then how should I do it?

There’s a code sample on that article.

local MarketplaceService = game:GetService("MarketplaceService")
 
MarketplaceService.PromptProductPurchaseFinished:Connect(function (...)
	-- Print all the details of the prompt, for example:
	-- PromptProductPurchaseFinished 269323 327064551 true
	print("PromptProductPurchaseFinished", ...)
end)

It fires when the developer product’s OK button was pressed.

You use .ProcessReceipt to process purchases, so you use .ProcessReceipt to store whether it was successful, then you can use the .PromptProductPurchaseFinished to fire it when the popup was closed.

Nevermind you can use it for devproducts

Well how do I know if the which devproduct is which is it like processReciept?

It’s passed as one of the arguments.

marketplaceService.PromptProductPurchaseFinished:Connect(function(userId, productId, purchaseSuccessful) -- here
    if purchaseSuccessful then
        print(game:GetService('Players'):GetPlayerFromUserId(userId).Name..' purchased product '..productId)
    else
        print(game:GetService('Players'):GetPlayerFromUserId(userId).Name..'\'s product purchase was closed but they didn\'t purchase anything!')
    end
end