Problem with roblox Documentation about DevProducts

So right here i just post the whole script i made, but the explications are below the script →

local Price = {300, 750, 2000, 10000}
local ids = {1570289776, 1570289898, 1570290492, 1570290617}

productFunctions = function(receipt, plr)
	local Tout = plr:FindFirstChild("Tout")
	local Coins = Tout and Tout:FindFirstChild("Coins")
	if Coins then
		local amount = Price[table.find(ids, receipt['ProductId'])]
		Coins.Value += amount
		rs.ClientEvents.DevProductsOk:FireClient(plr, amount)
		coroutine.wrap(save)(plr, nil, true)		
		return true
	end
end

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

	local player = Players:GetPlayerByUserId(userId)
	if player then
		local handler = productFunctions
		
		local success, result = pcall(handler, receiptInfo, player)
		if success then
			return Enum.ProductPurchaseDecision.PurchaseGranted
		end
	end
	return Enum.ProductPurchaseDecision.NotProcessedYet
end
MarketService.ProcessReceipt = processReceipt

So the script above use the ProcessReceipt function of the Roblox documentation official, the problem is just here →

		local success, result = pcall(handler, receiptInfo, player)
		if success then
			return Enum.ProductPurchaseDecision.PurchaseGranted
		end
	end
	return Enum.ProductPurchaseDecision.NotProcessedYet

With theses lines of code, even if the function handler don’t return true it’ll still return Enum.ProductPurchaseDecision.PurchaseGranted while it shouldn’t as something wrong happened with the handler → the player loss his robux.

To fix this it is very simple, you just need to add result in the condition →

		local success, result = pcall(handler, receiptInfo, player)
		if success and result then
			return Enum.ProductPurchaseDecision.PurchaseGranted
		end
	end
	return Enum.ProductPurchaseDecision.NotProcessedYet

In this case if it doesn’t return true, it’ll return Enum.ProductPurchaseDecision.NotProcessedYet and you’re safe with your player.

I think it could be fixed in the documentation or i’m not sure if this “error” is intented…

You have also provided a solution to fix the issue by adding result in the condition. So?

yes, as I said, but the purchase of dev products in a game with robux must be safe. I wonder how/why this error can be found in the official documentation.

Wrong section posting. Email roblox support about this or use another section

It can still help developpers that facing same issue in the future