Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I confirm a purchase has been made?

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

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.