Product issue when i bought it

I make a script that will make print when i bought a product.

but when i bought it. it dont print?

local MPS = game:GetService("MarketplaceService")

local players = game:GetService("Players")

local ProductID = 1175116573


local function processReceipt(receiptInfo)
	wait()
	
	local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		
		return Enum.ProductPurchaseDecision.NotProcessedYet
		
	end
	
	if receiptInfo.PurchasedID == ProductID then
		if player then
			wait()
			print(player.Name.. " Bought the product!".. player.UserId)
	
		end
	end
	
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

MPS.ProcessReceipt = processReceipt

on the last iine do this


MPS.ProcessReceipt:Connect(processReceipt)

and change this

if receiptInfo.PurchasedID == ProductID then

to this

if receiptInfo.ProductId == ProductID then
1 Like

This is incorrect. ProcessReceipt is not a function, it’s a callback.

@OP, do this:

local processReceipt = function(receiptInfo)
-- Code

MPS.ProcessReceipt = processReceipt
1 Like