I have a game with a leaderboard that has multiple values. The player money, level, etc. It is ordered by the player names. How do I change it so it’s ordered by the levels?
What do you mean by that? Do you mean if you level up you get more money?
If you want it like that you do:
game.Player.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new(“Folder”)
leaderstats.Name = leaderstats
leaderstats.Parent = player
local coins = Instance.new(“IntValue”)
coins.Name = “Coins”
coins.Parent = leaderstats
local level = Instance.new(“IntValue”)
level.Name = “Level”
level.Parent = player
if Level.Value == 1 then
Coins.Value = Coins.Value + --However much you want the player to get
No, I mean. The leaderboard rn looks something like this:
Name Level Coins
deiviircs 2 37
Mestik78 5 20
Sentrox17 3 15
and I want it to be shorted by the level, something like this:
Name Level Coins
Mestik78 5 20
Sentrox17 3 15
deiviircs 2 37
So you want the person with the highest level at the top?
yes, that’s what I want to do…
i an pretty sure roblox already does this to the first value that is added to the leaderstats folder.
Ye thats the new thing, maybe this is offtopic?
Ok can I see the script so I can work it out
Ok I think I got the script. Here it is:
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Level = Instance.new("IntValue")
Level.Name = "Level"
Level.Parent = leaderstats
Level.Value = 100
local Coins = Instance.new("IntValue")
Coins.Name = "Coins"
Coins.Parent = leaderstats
Coins.Value = 50
end)
You could also use team test and on the bottom of your screen you see a command bar. In the command bar say:
game.Workspace.Players.Player1.leaderstats.Level.Value = 1000
then you do:
game.Workspace.Players.Player2.leaderstats.Coins.Value = 1000000000000000000000000000
This will still make Player1 the highest.