I’m facing an issue with getting the “MarketplaceService.ProcessReceipt” to fire. I fires roughly 10% of the time and prints out the player who bought the developer product (the first 2 prints on the serversided script). I have tried multiple different methods to get it to fire 100% of the times but failed all the times and I have no clue on what is wrong… If I join the game in studio, it will sometimes print everything out, while leaving the game and joining back and havent editted in the script it wont print it all out. If anyone knows what is wrong please give me feedback!
I have uploaded screenshots of what the output says…
Client-sided (completely functions)
local marketplace = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local rp = game:GetService("ReplicatedStorage")
local button = script.Parent
local deathmsg = button.Parent.Parent:WaitForChild("DeathMessage")
local id = 1174436046
button.Activated:Connect(function()
print("0.5")
marketplace:PromptProductPurchase(players.LocalPlayer, id)
print("0.6")
end)
rp:WaitForChild("KillAll").OnClientEvent:Connect(function(playerName)
deathmsg.Text = playerName .. " killed everyone!"
deathmsg.Visible = true
wait(5)
deathmsg.Visible = false
end)
Server-sided (Issue)
local MarketplaceService = game:GetService("MarketplaceService")
local PlayerService = game:GetService("Players")
local rp = game:GetService("ReplicatedStorage")
local id = 1174436046
local function Process(Info, plr)
wait(1)
print(Info.PlayerId)
local plrId = PlayerService:GetPlayerByUserId(Info.PlayerId)
print(plrId)
if not plrId then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if Info.ProductId == id then
for i, v in pairs(PlayerService:GetPlayers()) do
if v ~= plrId then
local character = v.Character
if v.Character then
print("working")
end
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
MarketplaceService.ProcessReceipt = Process