Hello, I have problem with devproducts. When player buy gold it won't add him it.
Here is script:
game.StarterGui.ResetPlayerGuiOnSpawn = false
local MarketplaceService = game:GetService("MarketplaceService")
function getPlayerFromId(id)
for i,v in pairs(game.Players:GetChildren()) do
if v.userId == id then
return v
end
end
return nil
end
MarketplaceService.ProcessReceipt = function(receiptInfo)
local productId = receiptInfo.ProductId
local playerId = receiptInfo.PlayerId
local player = getPlayerFromId(playerId)
local productName
if productId == 32364216 then
productName = "2,000G"
local cashmoney = game.leaderstats.Gold:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 2000
end
elseif productId == 32364229 then
productName = "5,000G"
local cashmoney = game.leaderstats.Gold:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 5000
end
elseif productId == 32364246 then
productName = "10,000G"
local cashmoney = game.leaderstats.Gold:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 10000
end
end
local message = Instance.new("Hint",workspace)
message.Text = player.Name.." purchased "..productName.."!"
coroutine.resume(coroutine.create(function()
wait(2)
message:destroy()
end))
return Enum.ProductPurchaseDecision.PurchaseGranted
end
I think local cashmoney is wrote wrong...

1 comment
Okay, thank you :) Yeah i thought about it, but i wanted to ask first.