Here's the code I have:
01 | local players = game:WaitForChild( "Players" ) |
02 |
03 | local function createLeaderboard(player) |
04 | local stats = Instance.new( "Folder" ) |
05 | stats.Name = "leaderstats" |
06 | local rank = Instance.new( "IntValue" , stats) |
07 | rank.Name = "Rank" |
08 | rank.Value = 0 |
09 | stats.Parent = player |
10 | end |
11 |
12 | players.PlayerAdded:connect(createLeaderboard) |
Here's the code I want:
01 | local players = game:WaitForChild( "Players" ) |
02 |
03 | local function createLeaderboard(player) |
04 | local stats = Instance.new( "Folder" ) |
05 | stats.Name = "leaderstats" |
06 | local rank = Instance.new( "IntValue" , stats) |
07 | rank.Name = "Guest" -- I know it's an error. |
08 | rank.Value = 0 |
09 | stats.Parent = player |
10 | end |
11 |
12 | players.PlayerAdded:connect(createLeaderboard) |
The last code had an error. Could you help me?
If you want a leaderstats value to have letters, you need a StringValue, not an IntValue. IntValues take whole numbers, while StringValues take strings (or text)
01 | local players = game:WaitForChild( "Players" ) |
02 |
03 | local function createLeaderboard(player) |
04 | local stats = Instance.new( "Folder" ) |
05 | stats.Name = "leaderstats" |
06 | local rank = Instance.new( "StringValue" , stats) |
07 | rank.Name = "Guest" |
08 | rank.Value = "Guest" -- change "guest" to the rank you want |
09 | stats.Parent = player |
10 | end |
11 |
12 | players.PlayerAdded:connect(createLeaderboard) |