Here's my code so far -
01 | ShekelsGiven = 100 |
02 |
03 | ProductID = 31831485 |
04 |
05 | game:GetService( "MarketplaceService" ).ProcessReceipt = function (receiptInfo) |
06 |
07 | for i, player in ipairs (game.Players:GetChildren()) do |
08 |
09 | if player.userId = = receiptInfo.PlayerId then |
10 |
11 | if receiptInfo.ProductId = = ProductID then |
12 |
13 | if receiptInfo.CurrencyType = = Enum.CurrencyType.Robux then |
14 |
15 | player.ShopValues.Shekels.Value = player.ShopValues.Shekels.Value + ShekelsGiven |
Thanks for reading.
You would do this:
01 | local ShekelsGiven = 100 |
02 | game:GetService( "MarketplaceService" ).ProcessReceipt = function (receiptInfo) |
03 | for i, player in ipairs (game.Players:GetChildren()) do |
04 |
05 | if player.userId = = receiptInfo.PlayerId then |
06 |
07 |
08 | -- check which product was purchased |
09 | if receiptInfo.ProductId = = productId then |
10 |
11 | if receiptInfo.CurrencyType = = Enum.CurrencyType.Robux then |
12 | player. leaderstats.Shekels.Value = player. Leaderstats.Shekels.Value + ShekelsGiven |
13 |
14 | end |
15 | end |
16 | end |
17 | end |
18 | return Enum.ProductPurchaseDecision.PurchaseGranted |
19 | end ) |
Change Shekels in leaderstats to whatever you have as the leaderstats value for storing the points. Place this code in a Server Script as only the server can process receipts.