Hello!
I have re-written my script a bit and am still have issues w/it working. I am trying to add +1 to the customers leaderstat any time they purchase a clothing item from my home store, I have this as a server script:
local mps = game:GetService("MarketplaceService")
mps.ProcessReceipt = function(receiptInfo)
local Player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
if receiptInfo.ProductId == 1234546 then
Player.leaderstats.Purchases.Value = Player.leaderstats.Purchases.Value + 1
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif receiptInfo.ProductId == 12345467 then
Player.leaderstats.Purchases.Value = Player.leaderstats.Purchases.Value + 1
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
I used "123456" and "1234567" as placeholders, I would put the actual ID of the item there in game.
I have a basic leaderstat script:
game.Players.PlayerAdded:Connect(function(plr)
local Stats = Instance.new('Folder')
Stats.Name = 'leaderstats'
Stats.Parent = plr
local Purchases = Instance.new('IntValue')
Purchases.Name = 'Purchases'
Purchases.Value = 0
Purchases.Parent = Stats
end)
Any suggestions or thoughts as to why this is not working?

1 comment
ProcessReceipt only works with Developer Products.