Is there any simpler way of handling multiple Developer Products that give different amounts of money than making an individual script for each?

Here's my current script (Developer Product Handler):

local MarketplaceService = game:GetService('MarketplaceService')
local devproductid = 274918317 --100 cash

MarketplaceService.ProcessReceipt = function(receiptInfo)
	for i, player in ipairs(game.Players:GetChildren()) do
		if player.userId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == devproductid then
				player.leaderstats.Money.Value = player.leaderstats.Money.Value + 100 -- give them the cash
			end
		end
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

How could I handle multiple devproducts that all give cash without making multiple scripts? Thanks.

2 comments

0

Thanks