Hello!
I am trying to get my leaderstat "Purchases" to increase when a player buys something in my store:
local mpService = game.getService("MarketplaceService") mpService.ProcessReceipt = function(purchaseInfo) local plr = game.getService("Players"):GetPlayerByUserId(purchaseInfo.PlayerId) if purchaseInfo.ITEM_ID == 123456 then --The value that will be incremented local Purchases = plr.leaderstats.Purchases; Purchases.Value = Purchases.Value +1 end return Enum.ProductPurchaseDecision.PurchaseGranted end
I put 123456 as a placeholder, but it would be the actual ID of the clothing item being purchased.
Any help would be appreciated, TY
Just a syntax error on line 4, you used "game.getService", you have to use "game:GetService"
local plr = game:GetService("Players"):GetPlayerByUserId(purchaseInfo.PlayerId) -- fixed line 4