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

How do I give stuff with a dev product?

Asked by 1 year ago
Edited 1 year ago

I've been trying to make a dev product, and make it give a currency when they buy it but it isn't working, even though I'm pretty sure I have all the syntax correct, and it isn't showing an error.

Here is my script:

local productID = 1270692852

local MPS = game:GetService('MarketplaceService')

local function processRecipet(RecieptInfo)

    local plr = game.Players:GetPlayerByUserId(RecieptInfo.PlayerId)

    if not plr  then
        -- plr probably left.
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end

    if RecieptInfo.PurchaseId == productID then
        local leaderstats = plr:WaitForChild('leaderstats')
        local Gems = leaderstats:WaitForChild('Gems')
        Gems.Value = Gems.Value + 50
    end


    return Enum.ProductPurchaseDecision.PurchaseGranted

end

-- call back

MPS.ProcessReceipt = processRecipet

This is where I'm trying to give the currency:

    if RecieptInfo.PurchaseId == productID then
            local leaderstats = plr:WaitForChild('leaderstats')
            local Gems = leaderstats:WaitForChild('Gems')
            Gems.Value = Gems.Value + 50
    end

All of this is in a server script in ServerScriptService.

0
I figured it out, I just changed purchaseId to ProductId. starranger4 4 — 1y

Answer this question