Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Detecting when cancel is pressed when purchasing a Developer Product?

Asked by
xAtom_ik 574 Moderation Voter
7 years ago
Edited 7 years ago

Issue

So, I am trying to make a few purchases happen one after one, but then I realised it would not work. I looked it up online and couldn't find anything, so I am going to ask it here. How do I detect if the 'Cancel' button is pressed when purchasing a Developer Product?


What I tried

I have attempted to use PromptPurchaseFinished but it does not fire.


My code

game:GetService("MarketplaceService").PromptPurchaseFinished:connect(function(player, assetId, isPurchased)
    if isPurchased then
        print(player.Name .. " bought an item with AssetID: " .. assetId)
    else
        print(player.Name .. " didn't buy an item with AssetID: " .. assetId)
    end
end)

I have attempted this in a normal script and local script, same results, nothing. No errors. Code is also from the wiki, but I used the exact same thing

0
This code should run, make sure you have not disable the script and that is is running by adding in a print to the top of the code. User#5423 17 — 7y
0
It is running, and the print is visible. xAtom_ik 574 — 7y

Answer this question