local MarketplaceService = game:GetService("MarketplaceService")
local Products = {
[335171701]=function(receipt,player) --100 Power
player.leaderstats.Power.Value = player.leaderstats.Value + 100
end
}
function MarketplaceService.ProcessReceipt(receiptinfo)
local playerProductKey = receiptinfo.PlayerId..":"..receiptinfo.PurchaseId
local plr = game:GetService("Players"):GetPlayerByUserId(receiptinfo.PlayerId)
local handler
for ProductId, func in ipairs(Products) do
if ProductId == receiptinfo.ProductId then
handler = func break
end
end
local suc = pcall(handler,receiptinfo,plr)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
and the output says, bad argument pcall, but i don't know what that means.

3 comments
Pcall should be wrapping a function, it can then stop the function and not the script if need be. “pcall(function()”
Did you read this?: https://www.robloxdev.com/api-reference/callback/MarketplaceService/ProcessReceipt
I don't even see a need for a pcall here