Cant have 2 purchases

Hello everyone and i am having trouble using marketplace service. The problem that i am having is that i cant have 2 market place services in my game at once. I have an idea why this is happening but i have to comment out the other purchase in order for the first one to be able to go through. Also im leaving soon, replying as soon as i can.

Code:

local MPS = game:GetService("MarketplaceService")
MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1120388828 then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		game.Lighting.QuirkSpinner.CommonFire.Spin:FireClient(player)
		game.Lighting.QuirkSpinner.PurchasedSpin:FireClient(player)
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

--[[MPS.ProcessReceipt = function(receiptInfo2)
	if receiptInfo2.ProductId == 1128082012 then
		local player = game.Players:GetPlayerByUserId(receiptInfo2.PlayerId)
		game.Lighting.QuirkSpinner.UncommonFire.Spin:FireClient(player)
		game.Lighting.QuirkSpinner.PurchasedSpin2:FireClient(player)
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end]]

Thank you and feel free to ask questions / send links to help

Instead of having 2 functions you could simply use an elseif statement on your original conditional statement checking if ProductId is equal to a different one.

Example:

local MPS = game:GetService("MarketplaceService")
MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1120388828 then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		game.Lighting.QuirkSpinner.CommonFire.Spin:FireClient(player)
		game.Lighting.QuirkSpinner.PurchasedSpin:FireClient(player)
		return Enum.ProductPurchaseDecision.PurchaseGranted
    elseif receiptInfo.ProductId == 1120388828 then
            --do whatever here
	end
end
1 Like