How to make devproduct purchase activate a function?

I figured out how to activate a developer product purchase, now how do I make it so if the player purchases it something actually happens?

image

You will need to write a receipt handler for your developer products. It should handle edge cases with over-riding keys and product specific callbacks. Please carefully read the documentation for ProcessReceipt to avoid conflicts.

The actual endpoint is MarketplaceService.ProcessReceipt.

MarketPlaceService.PromptProductPurchaseFinished:Connect(function(PlayerUserId, PurchasedProductId, Purchased)
	if Purchased == true and PurchasedProductId == DevProductId then
		
		
	end
end)

You can use PromptProductPurchaseFnished. This allows you to detect if they bought it or haven’t bought it. You can also include a function within the script.

Simply catching a product purchase without processing receipts will inevitably lead to problems. Always write a proper handler for dev products.

PromptProductPurchaseFinished is deprecated, and should not be used.

1 Like