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 4 years ago
Edited 4 years ago

Here's the code I have:

local players = game:WaitForChild("Players")

local function createLeaderboard(player)
    local stats = Instance.new("Folder")
    stats.Name = "leaderstats"
    local rank = Instance.new("IntValue", stats)
    rank.Name = "Rank"
rank.Value = 0 
    stats.Parent = player
end

players.PlayerAdded:connect(createLeaderboard)

Here's the code I want:

local players = game:WaitForChild("Players")

local function createLeaderboard(player)
    local stats = Instance.new("Folder")
    stats.Name = "leaderstats"
    local rank = Instance.new("IntValue", stats)
    rank.Name = "Guest"   -- I know it's an error.
rank.Value = 0 
    stats.Parent = player
end

players.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 — 4y
0
It's not rank.Name, it's rank.Value + IntValue's is for numbers only. Rinextel 291 — 4y
0
You want to use a StringValue Rinextel 291 — 4y

1 answer

Log in to vote
2
Answered by 4 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)

local players = game:WaitForChild("Players")

local function createLeaderboard(player)
    local stats = Instance.new("Folder")
    stats.Name = "leaderstats"
    local rank = Instance.new("StringValue", stats)
    rank.Name = "Guest"   
    rank.Value = "Guest" -- change "guest" to the rank you want
    stats.Parent = player
end

players.PlayerAdded:connect(createLeaderboard)
Ad

Answer this question