Multiple Dev Products not working

So I am making a game and I made a gui that if you buy it, it adds cash to your money, I have 4 of them and when you join only 1 will work, they are the same script it’s just I change the product Id, I tried putting them in different scripts still won’t work. There are 4 scripts.

The script:
local MarketPlaceService = game:GetService(“MarketplaceService”)

MarketPlaceService.ProcessReceipt = function(Info)
if Info.ProductId == 1206855650 then (I change this in every script)
local Player = game.Players:GetPlayerByUserId(Info.PlayerId)
Player.leaderstats.Cash.Value += 10000 (Also this)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end

No errors in output.

2 Likes

You can’t have multiple .ProcessReceipt scripts/functions.

Is there anything else I can use instead? For multiple dev products

Handle all of your developer products in a single script.

2 Likes

MarketPlaceService.ProcessReceipt should be used only once. you should make 1 script to handle all dev products:

local MarketPlaceService = game:GetService("MarketplaceService")

local products = {
	{ -- duplicate this array 4 times and change values
		product = 1206855650, -- product id
		money = 10000 -- here is how much money you will gain
	}
	
}
MarketPlaceService.ProcessReceipt = function(Info)
	for i, v in pairs(products) do
		if v.product == Info.ProductId then
			local Player = game.Players:GetPlayerByUserId(Info.PlayerId)
			Player.leaderstats.Cash.Value += v.money 
			return Enum.ProductPurchaseDecision.PurchaseGranted
		end
	end
end
3 Likes