Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you add to a value in a leaderboard?

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?

 function clicked() 
if	script.Parent.Parent.TextBox.Text == "ROFL"
	then
	script.Parent.Parent.Parent.Parent.Parent.leaderstats.Points.Value = 500
else
	script.Parent.Parent.Parent.Parent.Parent.leaderstats.Points.Value = 0

end
end
script.Parent.MouseButton1Click:connect(clicked)

2 answers

✓ Accepted answer

I believe it would look something like this .

Player.leaderstats.Points.Value = Player.leaderstats.Points.Value + 1

1 comment

0

oh okay

This might work:

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

This discussion is preserved as it was. New answers, comments, and votes are closed.