What's the best way to handle a custom leaderboard?

I’ve made custom leaderboards before and have always had the client’s GUI script check for any players that join or leave the game. Would it be more efficient to fire an event from the server to all clients telling them a player has joined/left instead of just having that piece of code in every client’s GUI active?

Edit: after thinking through it more thoroughly the current method definitely appears to be the way to go

What does that code look like? If it’s listening for PlayerAdded/PlayerRemoving to fire then that’s fine.

1 Like

You’ll need to use a remote to fire every client when a player joins/leaves[using PlayerAdded/PlayerRemoving] and by that, you can clone a template frame with custom text/icons to players. When the player leaves. remove the frame named on him - for everyone.

I can write either method but which one would be better to use performance wise?

Using a remote, from client to server.

There’s 0 point in using a remote. Waste of effort. Your current method is fine.

Your leaderboard is fine. But I suggest using a function to do that, by looping through the UI that handles the player’s template and destroy it, once it’s destroyed, you can clone again the template and with the player name.

Add to the end game.Players.ChildAdded:Connect(yourFunctionName) And ChildRemoved too.
Hope this helps! :slightly_smiling_face:

PlayerAdded does not work on the client(local script). Using a remote to fire the clients whenever a player joined/left would do the job

You still don’t need a whole remote to make a simple client leaderboard. You can check all the players on the client. From that just use common knowledge. A loop, childadded, etc.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.