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

How do I confirm a purchase has been made?

Asked by 4 years ago
local function promptPurchase(plr)

    MarketplaceService:PromptProductPurchase(plr, productID)

end

clicker.MouseClick:Connect(promptPurchase)

The script above just activates the developer product purchase screen, but once they've made the purchase is there a certain line of code I can put in to know they've paid? Currently all this code does is activate the developer product purchase screen.

CurrencyToCollectt.Value = CurrencyToCollectt.Value + 100 --Amount added

I want to insert that code into the next function so after the purchased has been completed they'll receive what they paid for [ Code above ]. It's just giving them 100 Cash.

I've looked at the wiki and I'm assuming I just don't understand? It explains handling receipts, but I'm not sure if that'll help me confirm the purchase went through or not and if I can give them what they paid.

1 answer

Log in to vote
0
Answered by
royaltoe 5144 Moderation Voter Community Moderator
4 years ago

Once a player confirms the purchase, the process receipt function will be invoked where you can decide what to do when they bought it.

The parameter of the function is a table called 'receiptInfo' which contains the purchaseId, playerId, ProductId, (amount of) CurrencySpent, and the place where the gamepass was purchased.

There's a code example on the page if you want to learn more about it.

Ad

Answer this question