DevProducts not working

Salutations,

Recently I’ve been working on games and I’ve encountered this problem twice. The player gets charged for devproduct but it doesn’t identifies that if the product is bought or not. Here is my code:

local mps = game:GetService("MarketplaceService")


local CoinsProductIDs = 
	{
		[1189487558] = 50,
		[1189487479] = 200,
		[1189487399] = 500,
		[1189487322] = 1000,
	}


mps.ProcessReceipt = function(purchaseInfo)
	
	print("lol")


	local plrPurchased = game.Players:GetPlayerByUserId(purchaseInfo.PlayerId)

	if not plrPurchased then

		return Enum.ProductPurchaseDecision.NotProcessedYet
	end


	for productID, coinsGiven in pairs(CoinsProductIDs) do

		if purchaseInfo.ProductId == productID then


			plrPurchased.DataFolder.Coins.Value = plrPurchased.DataFolder.Coins.Value + coinsGiven

			return Enum.ProductPurchaseDecision.PurchaseGranted
		end
	end
end

However, the script isn’t printing “lol”. What is causing the problem? This is very annoying.

Does your game have any other script that sets the MarketplaceService.ProcessReceipt, like a donation board script or anything? One place can only have one function associated to the MarketplaceService.ProcessReciept.

There are many topics regarding this issue (these are some):

1 Like