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
4 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:

game:GetService("MarketplaceService").ProcessReceipt = function(purchaseInfo)
    local plr = game:GetService("Players"):GetPlayerByUserId(purchaseInfo.PlayerId) --Defines the player who bought the product
    if purchaseInfo.ProductId == 951160290 then --Replace with your product ID
        plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + 100 --Cash to be given
    end
    if purchaseInfo.ProductId == 951160339 then --Replace with your product ID
        plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + 500 --Cash to be given
    end
    if purchaseInfo.ProductId == 951160900 then --Replace with your product ID
        plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + 1500 --Cash to be given
    end
    if purchaseInfo.ProductId == 951160941 then --Replace with your product ID
        plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + 3000 --Cash to be given
    end
    if purchaseInfo.ProductId == 951160984 then --Replace with your product ID
        plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + 5000 --Cash to be given
    end
    if purchaseInfo.ProductId == 951161055 then --Replace with your product ID
        plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + 10000 --Cash to be given
    end

    return Enum.ProductPurchaseDecision.PurchaseGranted --Makes sure the player has bought the DevProduct
end

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

1 answer

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

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

MPS.ProcessReceipt = function(receiptInfo)
    if receiptInfo.ProductId == 944587847 then -- replace with your ID here
        local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
        player.leaderstats.Gems.Value = player.leaderstats.Gems.Value + 100000 -- CHANGE THIS TO YOUR CURRENCY
        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 — 4y
0
bruh just use a print function if you dont know whats going on SoftlockedUnderZero 668 — 4y
Ad

Answer this question