Problem with developer products

I’m trying to make a developer product, but I get an error saying that Studio is indexing nil with UserId? What am I doing wrong?

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local productID = 1672911914

wait(10)
local function processReceipt(receiptInfo)
	local player = Players:GetPlayerByUserId(receiptInfo.UserId)
	
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	if player then
		print("Developer product has been purchased successfully")
	end
	
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

MarketplaceService.ProcessReceipt = processReceipt()

Can you print receiptInfo?

I’ll try. Do you think I’m using the wrong variable, maybe?

We’ll see after you print it.

Instead, this should be:
MarketplaceService.ProcessReceipt = processReceipt

Remove the () parenthesis

2 Likes

Thanks! That fixed the problem!

1 Like

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