Attempting To Fire an Event when a Developer Product is purchased

Hi, I am trying to create a fireworks event to be triggered by a developer product purchase. I have the fireworks event set up, and I am looking for the necessary steps to intertwine the purchase + event. Thank you

1 Like

You can have a server script that will handle all the devproducts in your game:

local marketService = game:GetService("MarketplaceService")
local playersService = game.Players


local products = {
	["productID"] = function(player)
		--do your stuff here
		return true
	end,
}
marketService.ProcessReceipt = function(receiptInfo)
	local player = playersService:GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	local success,result = pcall(products[receiptInfo.ProductId],player)
	if not success or not result then
		warn("Error"..result)
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.