Creating a custom leaderboard - A few questions

Hello, so I’m currently trying to create a custom leaderboard and I have some questions before I start scripting it.

1 - Is there any way to make it so a scrolling frame doesn’t scroll past the content within it?

2 - What method would you recommend for adding players to the leaderboard and detecting if their team has changed?

3 - Are player icons (admin, premium, etc) required to be within the leaderboard?

4 - Is there any way to make a frame scale to the content within it? (Normal frame, not scaling)?


For context, here’s a screenshot of the scoreboard layout.
image

Hi!

  1. Yes - though not automatically. You can calculate the size of the Frame contents and set it accordingly - this will mean you can’t use Scale though.
  2. I’d recommend using Team.PlayerAdded and Team.PlayerRemoving events to register players.
  3. Nope - these aren’t required. Although, it is required that you do not show content between players who are blocked. You should check this before any sort of communication is allowed (for example, custom icons).
  4. Yes! You can calculate this by adding up the size of each component you want inside, and the spacing (if applicable) - there is also a way of doing this with UI Constraints, however I wouldn’t be able to provide you with specifics for a situation without background of what you might want to do specifically there.
1 Like

Want to provide an extension here regarding point three: there are several methods available for you to use when accounting for blocking communication for players, either because they’re blocked or as a respect to the privacy settings on their account. Here are the in-engine APIs:

CanUserChatAsync
Returns a boolean value whether the player is permitted to chat or not as a result of the privacy settings on their account. This is chiefly the Who can chat with me? option.

CanUsersChatAsync
Returns a boolean value whether two players are allowed to communicate with each other. This takes both of their account settings into consideration first and I believe relation status second (blocked users cannot chat with each other). [requires citation]

StarterGui:GetCore(“GetBlockedUserIds”)
Returns an array of UserIds of the users who the LocalPlayer blocked. Users do not have to be online for a UserId to be included. This list can be used to omit various kinds of contact.

Since Team is a value of Player, it is possible to use Player:GetPropertyChangedSignal(“Team”)

Check the API reference on :GetPropertyChangedSignal() for more info.