Developer product isn't working correctly

So, I’ve been working on a dev product where you can buy currency. I’ve coded only 2 of the dev products, but for some reason, one of the products work while the other doesn’t. Take a look:


And the code is completely different.

The one for +500 XP:
local MPS = game:GetService("MarketplaceService")

MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1086801308 then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats.XP.Value = player.leaderstats.XP.Value + 500
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

The one for +50 XP:
local MPS = game:GetService("MarketplaceService")

MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1086808910 then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats.XP.Value = player.leaderstats.XP.Value + 50
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

Make sure the ProcessReceipt function is only being called once.

local MPS = game:GetService(“MarketplaceService”)

MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1086808910 then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats.XP.Value = player.leaderstats.XP.Value + 50
     elseif receiptInfo.ProductId == 1086801308 then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats.XP.Value = player.leaderstats.XP.Value + 500
	end
      return Enum.ProductPurchaseDecision.PurchaseGranted
end
2 Likes

Thanks for your help! It worked!