so i’ve recently run into a problem, this script isn’t working at all/ isn’t printing anything without error! normally all marketplace items would print atleast the receipt part, but not even when a single thing in the game is bought it won’t print anything, help!
local MPS = game:GetService("MarketplaceService")
MPS.ProcessReceipt = function(receiptInfo)
print("step 1")
if receiptInfo.ProductId == 1205859299 then
print("step 2")
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
print("step 3 is about the player which is "..(player))
player.Chance.Value += 36
print("final step complete")
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
normally i’m able to find out what happened but i’ve never run into this problem before, so thanks for reading and if you can, please help!
local MarketplaceService = game:GetService("MarketplaceService")
local Products = {
[0]=function(receipt,player) -- the 0 is id of product
player.leaderstats.Gems.Value += 5 -- this is what it does when product is bought
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 pairs(Products) do
if ProductId == receiptinfo.ProductId then
handler = func break
end
end
local suc = pcall(handler,receiptinfo,plr)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Ok so you are prompting the player to buy a Developer Product right?
That callback will only run if a player actually asks Roblox to buy something (you wont be charged if it’s in Studio)
local MPS = game:GetService("MarketplaceService")
local players = game:GetService("Players")
function processReceipt(receiptInfo)
if receiptInfo.ProductId == 1205859299 then
local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
if player then
player:WaitForChild("Chance").Value += 36
return Enum.ProductPurchaseDecision.PurchaseGranted
else
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end
end
MPS.ProcessReceipt = processReceipt
Make sure the developer product ID is correct & that the script is a server script in the correct location.
Pretty sure he is rebinding as there doesn’t seem to be any issue with his code. If even the “step 1” print isn’t being ran then something else is happening before the function.
found out the donation board isn’t causing any problems, but is there any easy way i could find if this was in one of the scripts? the reason i don’t know about where the script is is because i got hired after another scripter who was very messy and didn’t really sort anything, i disabled and noted his original devproduct handler but that didn’t do anything