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

How to change a leaderstats value?

Asked by
8jxms 9
4 years ago

So I want to make it so that when you click a part it gives you plus 1 win. The leaderstats are already set up and I know how to use clickdetectors. I just need to know how to use it to change a leaderstat value(leaderstat is in player btw).

1 answer

Log in to vote
0
Answered by 4 years ago
script.Parent.ClickDetector.MouseClick:Connect(function(plr) -- This gets the player that just clicked on the part
    local Wins = plr:WaitForChild("leaderstats"):WaitForChild("Wins")
    Wins.Value = Wins.Value + 1 -- Increment the value of Wins by 1 (or whatever you are incrementing by)
end)
0
Thanks for the help! 8jxms 9 — 4y
0
No problem! User#25852 0 — 4y
Ad

Answer this question