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

Changing players stats from a Click on ClickDetector?

Asked by
PredNova 130
9 years ago

So, I asked a question a few days ago, How do I get a players name from a click detector, And the answer I got was This I'm now wondering how I can change a IntValue that's in the player that clicked it? By no means am I asking for the script, Just the functions / ways I can go about doing it would be very helpful.

Thanks :)

1 answer

Log in to vote
2
Answered by 9 years ago

The ClickDetector.MouseClick event gives its listeners the player that clicked it. So, all you'd have to do to change the value of one of the player's stats is something like this:

local cd = path.to.click.detector

cd.MouseClick:connect(function(plrWhoClicked)
    plrWhoClicked.leaderstats.Stat.Value = plrWhoClicked.leaderstats.Stat.Value + 1
end)
0
Thanks :) PredNova 130 — 9y
Ad

Answer this question