01 | game.Players.PlayerAdded:Connect( function (players) |
02 | local folder = Instance.new( "Folder" ,players) |
03 | folder.Name = "leaderstats" |
04 | local Points = Instance.new( "IntValue" ,folder) |
05 | Points.Value = 0 |
06 | Points.Name = "Points" |
07 | local Rank = Instance.new( "StringValue" ,folder) |
08 | Rank.Name = "Amateur" |
09 | while true do |
10 | wait( 5 ) |
11 | Points.Value = Points.Value + 1 |
12 | end |
13 | if Points.Value > 9 then |
14 | Rank.Value = "Better" |
15 | end |
16 | end ) |
Im currently trying to make a a rank system EX : 10 points you can get the "Better" rank , but instead of working . When the points hit 10 , nothing happens , the rank is still at Amateur . I put this script in ServerScriptStorage , the outputs shows no errors , Any help would be greatful !
if only checks if points is bigger than 9 once solution: after the player added event add both loops as loops inside connects don't really play nice... put the if statement inside the loop and also the part where it adds 1 every 5 seconds
1 | --player added part |
2 |
3 | while true do |
4 | wait( 5 ) |
5 | Points.Value = Points.Value + 1 |
6 | if Points.Value > 9 then |
7 | Rank.Value = "Better" |
8 | end |
9 | end |
For your case specifically, do..
1 | while wait() do |
2 | if Points.Value > 9 then |
3 | Rank.Value = "Better" |
4 | end |
5 | end |