MarketPlaceService not working

I am making a product purchase in my game, but it is not doing anything. I had the same script in one of my previous games and that one worked, but when I moved it to my new game it didn’t work.

script
local MPS = game:GetService("MarketplaceService")
local ProductID = 1232153358
local Players = game:GetService("Players")
local function Receipt(ReceiptInfo)
	local BoughtProductId = ReceiptInfo.ProductId
	local Purchaser = Players:GetPlayerByUserId(ReceiptInfo.PlayerId)
	if not Purchaser then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	local player=  Purchaser
	if Purchaser and  BoughtProductId == ProductID then
		player.backpack.Value=  game.ReplicatedStorage._backpack.MoonBack  
		
		local read =  CFrame.new(player.Character.UpperTorso.CFrame.Position)
		player.Character.Humanoid:TakeDamage(999)
		wait(0.50)
		player.Character.UpperTorso.CFrame =  read
		
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end
MPS.ProcessReceipt = Receipt

Any help is greatly appreciated!!!
Have a happy new year! :slight_smile:

Add a few prints and see what isn’t happening, or if it’s hanging somewhere for some reason. Try this and let me know the output:

    print('ProcessReceipt')
	local BoughtProductId = ReceiptInfo.ProductId
	local Purchaser = Players:GetPlayerByUserId(ReceiptInfo.PlayerId)
	if not Purchaser then
        print('No purchaser')
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	local player=  Purchaser
	if Purchaser and  BoughtProductId == ProductID then
        print('Giving product')
		player.backpack.Value=  game.ReplicatedStorage._backpack.MoonBack  
		
		local read =  CFrame.new(player.Character.UpperTorso.CFrame.Position)
		player.Character.Humanoid:TakeDamage(999)
		wait(0.50)
		player.Character.UpperTorso.CFrame =  read
		
	end
    print('OK')
	return Enum.ProductPurchaseDecision.PurchaseGranted

Nothing prints at all. I tried again with a few more prints and it is the function that does not work. BTW it does not give any errors

Not even “ProcessReceipt”? Are you sure you’re prompting a developer product purchase and not a gamepass or another type of purchase?

1 Like

In addition to what @7z99 pointed out, verify that there is no other script with ProcessReceipt, there can only be one that uses this function.

1 Like