Developer products not working

So basically, a few months ago I made a dev product for 20 robux in my game that gives you coins. A lot of people bought it and even sometimes more than once. But now today I was working on more products using the same exact script, and when I bought it I didn’t get anything at all. So I have no idea if this has been going on the entire time. I copied a script from Roblox Itsself and put it in serverscriptservice, In output it keeps saying ’ Failed to process receipt: :arrow_forward: {…} attempt to call a nil value’

This is my script:

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

local productFunctions = {}

productFunctions[1574028110] = function(receipt, player)
	local stats = player:FindFirstChild("leaderstats")
	local gold = stats and stats:FindFirstChild("Coins")

	if gold then
		gold.Value = gold.Value + 200
		return true
	end
end

local function processReceipt(receiptInfo)
	local userId = receiptInfo.PlayerId
	local productId = receiptInfo.ProductId

	local player = Players:GetPlayerByUserId(userId)
	if player then
		-- Get the handler function associated with the product ID and attempt to run it
		local handler = productFunctions[productId]
		local success, result = pcall(handler, receiptInfo, player)
		if success then
			-- The player has received their benefits!
			-- return PurchaseGranted to confirm the transaction.
			return Enum.ProductPurchaseDecision.PurchaseGranted
		else
			warn("Failed to process receipt:", receiptInfo, result)
		end
	end

	-- the player's benefits couldn't be awarded.
	-- return NotProcessedYet to try again next time the player joins.
	return Enum.ProductPurchaseDecision.NotProcessedYet
end

-- Set the callback; this can only be done once by one script on the server!
MarketplaceService.ProcessReceipt = processReceipt
``

If you are getting “attempted to call a nil value” it means that you are missing a product function for the thing you are trying to buy.

1 Like