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

How do you add to a value in a leaderboard?

Asked by
Prioxis 673 Moderation Voter
11 years ago

So i'm making a GUI that if you put in a certain text it'll reward you with points sadly it sets the value to what I put it as in the script how to I make it to where its adding to the value?

01function clicked()
02if  script.Parent.Parent.TextBox.Text == "ROFL"
03    then
04    script.Parent.Parent.Parent.Parent.Parent.leaderstats.Points.Value = 500
05else
06    script.Parent.Parent.Parent.Parent.Parent.leaderstats.Points.Value = 0
07 
08end
09end
10script.Parent.MouseButton1Click:connect(clicked)

2 answers

Log in to vote
1
Answered by
NecoBoss 194
11 years ago

I believe it would look something like this .

1Player.leaderstats.Points.Value = Player.leaderstats.Points.Value + 1
0
oh okay Prioxis 673 — 11y
Ad
Log in to vote
0
Answered by 11 years ago

This might work:

1function clicked()
2local points = game.Players.LocalPlayer.leaderstats.Points
3if script.Parent.Parent.TextBox.Text == "ROFL" then
4points.Value = points.Value + 500 -- Adds 500 more points for the player
5else
6print("Wrong")
7end
8end
9script.Parent.MouseButton1Click:connect(clicked)

Answer this question