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

How do you make a leaderboard but instead of numbers, it's letters?

Asked by 5 years ago
Edited 5 years ago

Here's the code I have:

01local players = game:WaitForChild("Players")
02 
03local function createLeaderboard(player)
04    local stats = Instance.new("Folder")
05    stats.Name = "leaderstats"
06    local rank = Instance.new("IntValue", stats)
07    rank.Name = "Rank"
08rank.Value = 0
09    stats.Parent = player
10end
11 
12players.PlayerAdded:connect(createLeaderboard)

Here's the code I want:

01local players = game:WaitForChild("Players")
02 
03local 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.
08rank.Value = 0
09    stats.Parent = player
10end
11 
12players.PlayerAdded:connect(createLeaderboard)

The last code had an error. Could you help me?

0
Are you trying to make a leaderboard with group ranks in it? palav 104 — 5y
0
It's not rank.Name, it's rank.Value + IntValue's is for numbers only. Rinextel 291 — 5y
0
You want to use a StringValue Rinextel 291 — 5y

1 answer

Log in to vote
2
Answered by 5 years ago

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)

01local players = game:WaitForChild("Players")
02 
03local 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
10end
11 
12players.PlayerAdded:connect(createLeaderboard)
Ad

Answer this question