well I don’t know if this question really belong to this section but since it is a question about coding…
so. is there any difference between BuyingProductV1 and V2? or which one is safe
I don’t want to seem like scamming players or something,
or is there something I am forgetting about receipts? this is my first time creating DevProducts so sorry if this is a nonsense question?
both functions gives player +1 coin so? I really don’t know if there is something wrong or not
ProductFunctions[1733] = function(receipt,Player) -- Test Product Id
print("WELp")
if Player.Character and Player.Character:FindFirstChild("Humanoid") then
Player.leaderstats.Coins.Value += 1
return true
end
end
local function BuyingProductV1(ReceiptInfo)
local player = Players:GetPlayerByUserId(ReceiptInfo.PlayerId)
if not player then return Enum.ProductPurchaseDecision.NotProcessedYet
else
print("Welp2")
local Handler = ProductFunctions[ReceiptInfo.ProductId]
if not Handler then return Enum.ProductPurchaseDecision.NotProcessedYet
else
local success, Message = pcall(Handler,ReceiptInfo,player)
print("Welp3")
if success then
print("Successsss")
return Enum.ProductPurchaseDecision.PurchaseGranted
else
warn("Error")
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end
end
end
local function BuyingProductV2(ReceiptInfo)
local Player = Players:GetPlayerByUserId(ReceiptInfo.PlayerId)
if not Player then return nil end
local Handler = ProductFunctions[ReceiptInfo.ProductId]
if not Handler then
return nil
end
local success,Result = pcall(Handler,ReceiptInfo,Player)
if not success or not Result then
print("Error")
return nil
end
return true
end
MarketPlaceService.ProcessReceipt = BuyingProductV2
MarketPlaceService.ProcessReceipt = BuyingProductV1