MarketplaceService.ProcessReceipt not working?

I’m having issues with MarketPlaceService.ProcessReceipt.
When the user tries to buy a dev product, it prompts purchase, takes robux, but does not execute the function that is supposed to reward to the player.

local products = {
	[1605825426] = function(player)
		print("BOUGHT 25k")
		PlayerManager.SetMoney(player, PlayerManager.GetEntityIDFromTable(player), (PlayerManager.GetMoney(player, PlayerManager.GetEntityIDFromTable(player)) + 25000)) -- need to find entity id
		PlayerManager.BoughtSouls(player, 25000)
		return true
	end,
	[1606940687] = function(player)
		print("BOUGHT 200k")
		PlayerManager.SetMoney(player, PlayerManager.GetEntityIDFromTable(player), (PlayerManager.GetMoney(player, PlayerManager.GetEntityIDFromTable(player)) + 200000)) -- need to find entity id
		PlayerManager.BoughtSouls(player, 200000)
		return true
	end,
	[1606940956] = function(player)
		print("BOUGHT 1mil")
		PlayerManager.SetMoney(player, PlayerManager.GetEntityIDFromTable(player), (PlayerManager.GetMoney(player, PlayerManager.GetEntityIDFromTable(player)) + 1000000)) -- need to find entity id
		PlayerManager.BoughtSouls(player, 1000000)
		return true
	end,
}

MarketPlaceService.ProcessReceipt = function(info)
	print('MARKETPLACESERVICE')
	print(info)
	local player = Players:GetPlayerByUserId(info.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	
	local success, result = pcall(products[info.ProductId], player)
	if not success or not result then
		warn ("Error for product " .. result)
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

It does not print “MARKETPLACESERVICE” or the info, so i’m not sure if it’s even entering that function. This was working previously, I have no idea when it stopped.

1 Like

Have you checked if any other scripts use .ProcessReciept? .ProcessReciept can only connect to one function.

3 Likes

Of course i figured it out right after i posted this, I have 2 scripts where marketplace is prompted because of a donation board. Can’t have two of them!

3 Likes

I appreciate the solution even though you figured it out before I typed it out lol.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.