How would you go about making a custom player list with a leaderstat such as level next to the player

i found tutorials on just having the name but how can i add a leaderstat with it.

1 Like

You would have to edit your custom playerlist to have a column for a leaderstats value. Then you would handle getting the data in the playerlist script and changing the text to what is your stored value. Then since in the regular playerlist, anytime a value changes it shows up, so you would want to have either a while wait() do or you could use GetPropertyChangedSignal to detect whenever the value is changed. Then when it is detected, change the text on your playerlist to the new value.

That depends. If you’re using the default leaderboard, it’s as simple as adding an instance named leaderstats under the player and putting your values in there. There are several hundred tutorials and free models that cover how to do this, so I’m not too sure what the issue is.

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function (Player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"

    local level = Instance.new("IntValue")
    level.Name = "Level"
    level.Value = 1
    level.Parent = leaderstats

    leaderstats.Parent = Player -- Don't parent first, must instance children
end)

No.

The OP wanted a way/solution to how to make a custom playerlist with leaderstats values. You simply gave a script to make leaderstats in the roblox playerlist, which was not asked in the post. The OP can use whatever method they like to detect a change in the value to set the text, it does not mean you have to say “No” or “That’s wrong”. People can choose the way they want to do things if you do disagree that is your opinion. I simply was giving options on how they can approach settings the text to the custom playerlist.

3 Likes

There was a post about this less than two months ago that might help you out

That’s my bad for not reading.

There’s a specific reason why I argue against using while wait loops. It’s bad practice and bad code. From everything except a preferential standpoint, it’s not an opinion - it’s a fact that the idiom is bad. OP is certainly free to use whichever method they want to use text but at the cost of code efficiency.

If you’d like to discuss further, DM me, as the ensuing conversation would be off-topic.

You could use renderstepped to keep at accurate count of your players currency and set that as the text of your leaderboard:

 local runs = game:GetService("RunService")
 local stats = game.Players.LocalPlayer:WaitForChild("leaderstats")
 runs.RenderStepped:Connect(function()
      if script.Parent.Text ~= stats.Level.Value then
      script.Parent.Text = stats.Level.Value
      end
 end)

This is a very simple script that you can use as your basis for your script.

1 Like