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?
01 | function clicked() |
02 | if script.Parent.Parent.TextBox.Text = = "ROFL" |
03 | then |
04 | script.Parent.Parent.Parent.Parent.Parent.leaderstats.Points.Value = 500 |
05 | else |
06 | script.Parent.Parent.Parent.Parent.Parent.leaderstats.Points.Value = 0 |
07 |
08 | end |
09 | end |
10 | script.Parent.MouseButton 1 Click:connect(clicked) |
I believe it would look something like this .
1 | Player.leaderstats.Points.Value = Player.leaderstats.Points.Value + 1 |
This might work:
1 | function clicked() |
2 | local points = game.Players.LocalPlayer.leaderstats.Points |
3 | if script.Parent.Parent.TextBox.Text = = "ROFL" then |
4 | points.Value = points.Value + 500 -- Adds 500 more points for the player |
5 | else |
6 | print ( "Wrong" ) |
7 | end |
8 | end |
9 | script.Parent.MouseButton 1 Click:connect(clicked) |