I need help with Developer Products

I just made some Dev products for coins and levels and this code does not work for some reason:

game.MarketplaceService.ProcessReceipt = function(receiptInfo)
	local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
	if receiptInfo.ProductId == 1216872108 then
		plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 100
	end
end

Can anyone help me with this?

1 Like

You have to tell Roblox if the purchase works or not, try this

local Functions = {}
Functions[1216872108] = function(receiptInfo)
	local plr = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
	plr.leaderstats.Coins.Value += 100
end

game:GetService("MarketplaceService").ProcessReceipt = function(receiptInfo)
	local Success, Err = pcall(Functions[receiptInfo.ProductId], receiptInfo)
	if not Success then
		warn(Err)
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

Also, is there another script that uses ProcessReceipt? Only one can have that function

1 Like

It goes from 3.300 coins to 1.200 for some reason. Could you help me with this?

game.MarketplaceService.ProcessReceipt = function(receiptInfo)
	local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
	if receiptInfo.ProductId == 1216872108 and plr then
		plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 100
		return Enum.ProductPurchaseDecision.PurchaseGranted
	else
		return Enum.ProductPurchaseDescision.NotProcessedYet
	end
end
2 Likes

Also, yes. I made a few moire developer products. They all include ProcessReceipt. They’re all in one script though.