Hi, So I am making a code which handles pet devproducts and gamepasses. However, none of the print and warn functions are being called and I am sure that there are no other ProcessReceipt call backs. I used Ctrl + Shift + F to find it but there is only one script. The script is a module script ran by the server. Please help.
local RobuxServerModule = {}
--// Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MPS = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local DataStoreService = game:GetService("DataStoreService")
--// Variables
local Modules = script.Parent
local gamepassBroughtEvent = ReplicatedStorage:WaitForChild("GameClient"):WaitForChild("Events"):WaitForChild("RemoteEvent"):WaitForChild("GamepassBrought")
local purchaseHistoryStore = DataStoreService:GetDataStore("PurchaseHistory")
--// Modules
local EggHandler = require(Modules:WaitForChild("EggServerHandler"))
local DevpassID = {
--// Robux Egg
["RobuxEgg1"] = {1173925524, function(plr) return EggHandler:OpenSpecialEgg(plr, "Robux Egg", "Buy1") end};
["RobuxEgg2"] = {1173925574, function(plr) return EggHandler:OpenSpecialEgg(plr, "Robux Egg", "Buy3") end};
["RobuxEgg11"] = {1174795856, function(plr) return EggHandler:OpenSpecialEgg(plr, "Robux Egg22", "Buy1") end};
["RobuxEgg22"] = {1174795920, function(plr) return EggHandler:OpenSpecialEgg(plr, "Robux Egg22", "Buy3") end};
["RobuxEgg111"] = {1174991529, function(plr) return EggHandler:OpenSpecialEgg(plr, "Carnival RobuxEgg", "Buy1") end};
["RobuxEgg222"] = {1174991582, function(plr) return EggHandler:OpenSpecialEgg(plr, "Carnival RobuxEgg", "Buy3") end};
["RobuxEgg1111"] = {1175442829, function(plr) return EggHandler:OpenSpecialEgg(plr, "Carnival Robux2", "Buy1") end};
["RobuxEgg2222"] = {1175442851, function(plr) return EggHandler:OpenSpecialEgg(plr, "Carnival Robux2", "Buy3") end};
["OmegaRobot1"] = {1174277414, function(plr) return EggHandler:OpenSpecialEgg(plr, "Omega Robot", "Buy1") end};
["OmegaRobot2"] = {1174277535, function(plr) return EggHandler:OpenSpecialEgg(plr, "Omega Robot", "Buy3") end};
}
local function processReceipt(receiptInfo)
warn("Processing Reciept")
local playerProductKey = receiptInfo.PlayerId .. "_" .. receiptInfo.PurchaseId
local purchased = false
local success, errorMessage = pcall(function()
purchased = purchaseHistoryStore:GetAsync(playerProductKey)
end)
if success and purchased then
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif not success then
error("Data store error:" .. errorMessage)
end
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
local success, errorMessage = pcall(function()
purchaseHistoryStore:SetAsync(playerProductKey, true)
end)
if not success then
error("Cannot save purchase data: " .. errorMessage)
end
warn("Processing Reciept2")
gamepassBroughtEvent:FireClient(player, receiptInfo.ProductId)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
function RobuxServerModule:Int()
MPS.ProcessReceipt = function(receiptInfo)
print("Hi")
local plr = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if plr and receiptInfo then
local success = false
local idFound = false
for devProductName, tbl in pairs(DevpassID) do
if type(tbl) == "table" then
local id,func = tbl[1],tbl[2]
if id ~= nil and func ~= nil and type(func) == "function" then
if receiptInfo.ProductId == id then
idFound = true
local functionFinised = func(plr)
if functionFinised == false then
warn("Something went wrong when", plr.Name, "was buying a developer product!", devProductName)
success = false
else
-- send webhook if you want
success = true
end
break
end
end
end
end
if not idFound then
local processedResult = processReceipt(receiptInfo)
return processedResult
end
if success == true then
gamepassBroughtEvent:FireClient(plr, receiptInfo.ProductId)
return Enum.ProductPurchaseDecision.PurchaseGranted
else
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end
return RobuxServerModule