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

Developer Product was working, now it doesn't?

It will let someone purchase both 1,000,000 cash and 10,000,000 cash, however, only the 10,000,000 will get added. The 1,000,000 will not work. This is extremely confusing.

Here's the script:

local MarketplaceService = game:GetService('MarketplaceService')
local devproductid = 32819350 -- 10,000,000 Cash
local devproductid2 = 32819339

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.Cash.Value = player.leaderstats.Cash.Value + 10000000
			end
			elseif receiptInfo.ProductId == devproductid2
			then
			player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 1000000
		end
		
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

5 comments

0

You can merge the two script pretty easily. Just put and elseif on line 10 then "receiptInfo.ProductId == devProductId2" or something like that

0

I joined both of them together and it's still not working with the 1,000,000 purchase.

0

Are you sure you got the ID right?

0

Positive.

0

I've noticed in servers that it tends to work on one or the other. Never both.

1 answer

✓ Accepted answer

You ended the if statement that was comparing the developer product ids!

local MarketplaceService = game:GetService('MarketplaceService')
local devproductid = 32819350 -- 10,000,000 Cash
local devproductid2 = 32819339

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.Cash.Value = player.leaderstats.Cash.Value + 10000000
			elseif receiptInfo.ProductId == devproductid2 then
				player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 1000000
			end
		end
	end -- You were also missing one end.
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

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