Hello, I am having problem with Developer Product - the purchase pop-up does work and completed, but the problem I am having that the Leaderboard is not changing it's value.
Another words: The purchase thing works - just that the Leaderboard doesn't update the Coins after purchase.
Can anyone help me with the scripting???
Here is the part of the script that doesn't work.
mps.ProcessReceipt = function(info)
local plr = tonumber(getPlayerById(info.PlayerId))
if plr and plr:FindFirstChild "leaderstats" and plr.leaderstats:FindFirstChild "Coins" then
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 5
end
end
Here is a full script.
local buyButton = script.Parent
local productId = 19187415
local mps = game:GetService"MarketplaceService"
function getPlayerById(id)
for i,v in pairs(game.Players:GetPlayers()) do
if v.userId == id then
return v
end
end
end
buyButton.MouseButton1Click:connect(function()
mps:PromptProductPurchase(game.Players.LocalPlayer, productId)
end)
mps.ProcessReceipt = function(info)
local plr = tonumber(getPlayerById(info.PlayerId))
if plr and plr:FindFirstChild "leaderstats" and plr.leaderstats:FindFirstChild "Coins" then
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 5
end
end

3 comments
You should check to make sure the productId's match, and if they do THEN award the stats. Also your "plr" is just the Player'sID not the actual player.
You also need to use Enum.ProductPurchaseDecision.PurchaseGranted
http://wiki.roblox.com/index.php?title=ProcessReceipt_(Callback)