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

how do I decrease the leaderstats value with a click detector?

Asked by
To0_ny 141
3 years ago
Edited 3 years ago

I tried to make it whenever the player clicks the part, their money goes down by 10, it does not go down, what do I do

Script:

local click = script.Parent

click.MouseClick:Connect(function(player)
    local leader = player:WaitForChild("leaderstats")
    local cash = leader:WaitForChild("Cash")
    local money = cash.Value

    money = money - 10
end)
0
Get rid of line 6, then change line 8 to "cash.Value = cash.Value - 10" laurennial 0 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

~~~~~~~~~~~~~~~~~ click.MouseClick:Connect(function()

player.leaderstats.Cash.Value = player.leaderstats.Cash.Value -10 --How ever much you want to subtract ~~~~~~~~~~~~~~~~~

Ad

Answer this question