Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Could someone help me debug this script(regarding dev products)?

Asked by
8jxms 9
5 years ago

Someone in an earlier question helped me make a script that gives the player a certain amount of cash when purchasing a dev product. It worked with one but after stacking multiple products it didn't work. Here it is:

01game:GetService("MarketplaceService").ProcessReceipt = function(purchaseInfo)
02    local plr = game:GetService("Players"):GetPlayerByUserId(purchaseInfo.PlayerId) --Defines the player who bought the product
03    if purchaseInfo.ProductId == 951160290 then --Replace with your product ID
04        plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + 100 --Cash to be given
05    end
06    if purchaseInfo.ProductId == 951160339 then --Replace with your product ID
07        plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + 500 --Cash to be given
08    end
09    if purchaseInfo.ProductId == 951160900 then --Replace with your product ID
10        plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + 1500 --Cash to be given
11    end
12    if purchaseInfo.ProductId == 951160941 then --Replace with your product ID
13        plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + 3000 --Cash to be given
14    end
15    if purchaseInfo.ProductId == 951160984 then --Replace with your product ID
View all 23 lines...

NOTE: I also tried separating them into separate scripts but it still didn't work.

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Try this: local MPS = game:GetService("MarketplaceService")

1MPS.ProcessReceipt = function(receiptInfo)
2    if receiptInfo.ProductId == 944587847 then -- replace with your ID here
3        local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
4        player.leaderstats.Gems.Value = player.leaderstats.Gems.Value + 100000 -- CHANGE THIS TO YOUR CURRENCY
5        return Enum.ProductPurchaseDecision.PurchaseGranted

TO COPY: https://pastebin.com/raw/C2yZCn2H

0
That's what I originally did. I tried separate scripts and together, still didn't work 8jxms 9 — 5y
0
bruh just use a print function if you dont know whats going on SoftlockedUnderZero 668 — 5y
Ad

Answer this question