MarketplaceService.ProcessReceipt = function(ReceiptInformation)
local Player = Players:GetPlayerByUserId(ReceiptInformation.PlayerId)
local DataPurchases = DataStore2('DataPurchases',Player)
local playerProductKey = ReceiptInformation.PlayerId .. "_" .. ReceiptInformation.PurchaseId
local purchased = false
local success, errorMessage = pcall(function()
purchased = DataPurchases:Get(playerProductKey)
end)
print('1') -- prints 1
if success and purchased then
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif not success then
error("Data store error:" .. errorMessage)
end
print('2') -- DOES NOT PRINT 2 which means it stops here
local player = Players:GetPlayerByUserId(ReceiptInformation.PlayerId)
if not player then
-- The player probably left the game
-- If they come back, the callback will be called again
return Enum.ProductPurchaseDecision.NotProcessedYet
end
local handler = ProductFunctions[ReceiptInformation.ProductId]
-- Call the handler function and catch any errors
print('3')
local success, result = pcall(handler, ReceiptInformation, player)
if not success or not result then
warn("Error occurred while processing a product purchase")
print("\nProductId:", ReceiptInformation.ProductId)
print("\nPlayer:", player)
return Enum.ProductPurchaseDecision.NotProcessedYet
end
print('4')
local success, errorMessage = pcall(function()
DataPurchases:Set(playerProductKey, true)
DataPurchases:Save()
end)
if not success then
error("Cannot save purchase data: " .. errorMessage)
end
print('Done')
-- IMPORTANT: Tell Roblox that the game successfully handled the purchase
return Enum.ProductPurchaseDecision.PurchaseGranted
end
I think it stops at around line 16 or 20
