So, I created a buy cash with robux UI about a week ago, and it seemed to work fine in studio so I left it and assumed it worked. Today, someone in-game bought cash through the UI and it did not give him his cash. I then tested this for myself in game and it did not give me my cash either. I have tested this in studio since then, and the proccessing works fine in studio and does end up giving the cash. I will provide a link to a screenshot of my server output, which shows no errors in relationship to the devproduct script (The WaitForChild stuff is being outputted with my admin). I will also post my script below. I have also noticed, that it printed “Processed” in output when I successfully bought the dev product, but I don’t remember putting that in a script anywhere
Output → https://imgur.com/hu4bzun
--// Written by bellaouzo
--// 05/31/2020
local MarketplaceService = game:GetService("MarketplaceService")
local Notification = game:GetService("ReplicatedStorage"):WaitForChild("Notification")
--[[ Cash ID's ]]--
cashDict = {
[995851074] = 500,
[995851543] = 2500,
[995853514] = 10000,
[995853729] = 50000,
[995853920] = 100000,
}
--// Comma Function \\--
function addcomma(amount)
local formatted = amount
while true do
formatted, a = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if (a==0) then
break
end
end
return formatted
end
--// Process Receipt \\--
MarketplaceService.ProcessReceipt = function(receiptInfo)
local pid = receiptInfo.PlayerId
local dpid = receiptInfo.ProductId
local plr = game:GetService("Players"):GetPlayerByUserId(pid)
local cashAmount = cashDict[dpid]
if plr and cashAmount then
local plrd = plr.leaderstats.Cash
plrd.Value = plrd.Value + cashAmount
Notification:FireClient(plr, "Purchase", "Successful purchase.\nAdded $"..addcomma(cashAmount).." to your wallet.")
end
--// Purchase Granted
return Enum.ProductPurchaseDecision.PurchaseGranted
end