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

Problem with MarketplaceService?

Asked by 9 years ago

So I have this problem with MarketplaceService that it won't give me 10000 cash when I buy it online. Heres the script:

local gui = script.Parent
local plr = gui.Parent.Parent.Parent

local market = game:GetService("MarketplaceService")


function add10000cash()
    if plr then
        local leaderstats = plr:FindFirstChild("leaderstats")
        if leaderstats then
            local cash = leaderstats:FindFirstChild("Cash")
            if cash then
                cash = cash + 10000
            end
        end
    end
end

script.Parent.MouseButton1Click:connect(function()
    market:PromptProductPurchase(plr, 22957008, false, Enum.CurrencyType.Robux)
    add10000cash()
end)

Can anyone tell me whats happening? Thanks!

1 answer

Log in to vote
0
Answered by 9 years ago

I'm assuming "Cash" is a value. On line 13 change

cash = cash + 10000

to

cash.Value = cash.Value + 10000

But the way you have it, it will give the player 10000 money even when they don't buy the pass. Please take a look at this: ProcessReceipt

Ad

Answer this question