So I am currently making dev products in my game.
Where I run into this error.
Failed to process recipt: ▶ {...} attempt to call a nil value
I dont know why this is happening. So if you could help that would be amazing! Thanks
Give rewards.
productFunctions[1539404003] = function(recipt,player) -- 300 gems
local profile = player.Profile
if profile then
local gems = profile.Gems
gems += 300
return true
end
end
Handle the receipt.
local function handleRecipt(info) -- handle receipts!
warn('Loading receipt')
local ID = info.PlayerId
local ProductID = info.ProductId
local player = game:GetService('Players'):GetPlayerByUserId(ID)
if player then
local handler = productFunctions[ID]
local success, result = pcall(handler,info, player)
if success then
warn('Loaded recipt success!')
return Enum.ProductPurchaseDecision.PurchaseGranted
else
warn('Failed to process recipt:',info,result)
end
end
end
mps.ProcessReceipt = handleRecipt