I have this script that gives the player 50 coins when buying a product, although everything works fine, why am I getting the following error (warn)? (PRODUCT_ID
is specified, I just not included it)
Failed to process receipt: {…} attempt to call a boolean value
Script:
productFunctions[PRODUCT_ID] = function(receipt, player)
local playerInfo = player:FindFirstChild("PlayerInfo")
local coins = playerInfo and playerInfo.Values.Coins
if coins then
GaMe.addCoins(player,50)
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[productId](receiptInfo,player)
local success, result = pcall(handler, receiptInfo, player)
if success then
return Enum.ProductPurchaseDecision.PurchaseGranted
else
warn("Failed to process receipt:", receiptInfo, result) -- outputted thing
end
end
return Enum.ProductPurchaseDecision.NotProcessedYet
end