This script is a dev product that when bought is supposed to add 1,000 gold to the person's LeaderStats. However, no matter what I do I can't seem to get it to work. I'm pretty sure the problem is in line 22. There should be something to identify a certain player. Normally I would just put LocalPlayer but since that only works in local scripts I can't. If you need any more info on the problem post a comment on what you need to know. That is all.
-Full script
game.StarterGui.ResetPlayerGuiOnSpawn = false
old_fog = game.Lighting.FogStart
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 == 92719865 then
local Money = game.players.leaderstats.Gold
Money.Value = Money.Value + 1000
end

2 comments
ProcessReceipt is deprecated.
ProcessReceipt is deprecated, use the other events and functions.