Hiding specific teams from the sidebar

Hello,

I have a couple of internal teams that I don’t want to show the user. How would I hide those specific teams?

Thanks,
rad

4 Likes

You cannot hide a specific team.

You’ll either have to hide the whole PlayerList or have them all visible.

An alternative would be to make a custom PlayerList gui.

4 Likes

Obviously, yes.

But as this isn’t a post about making a custom player list I didn’t go into detail about how.

2 Likes

Alternatively, if you don’t want to disable the PlayerGui, you can do internal teaming via ModuleScripts, CollectionService tagging, ValueObjects or many, many other ways.

A custom PlayerGui is good for if you want to change the aesthetic, but it’s not necessarily the only way. You can still “hide teams” without hiding the leaderboard, just you can’t use a Team object because the CoreScript responsible for organising the PlayerList will file that team automatically.

1 Like

Hey, you can actually do this by deleting the teams locally on the client. I successfully did this in my game and it created no negative side effects.

5 Likes

Unless OP has another team they’re assigning the client to as their “main team” after deleting the “internal team” (since they want to hide specific teams), that’d just leave them under the Neutral category. That is a viable solution though, yeah.

Personally, I find that it’d be easier to handle all this via code or storing associative data with players.

No, if the team is destroyed locally they will remain on that team. Try it yourself.

I’ve used this trick multiple times and it’s never failed.

1 Like

I don’t think that solution is particularly future proof. If you have LocalScripts that require knowledge of if the player is in one of those internal teams, deleting the team would render this task difficult.

It isn’t difficult at all. You can just check their TeamColor locally to know their team. I’ve been doing this for 3+ years and never run into a problem.

1 Like

I’m talking about the leaderboard CoreGui itself. The client won’t see the leaderboard in the sort, they’ll be listed under “Neutral” if not re-teamed elsewhere via the client. The server will still recognise them as being present on that team, obviously because the team destruction doesn’t replicate.

1 Like

I just tested it again. Players don’t see the team on the leaderboard if it’s the only team or all other teams are destroyed. I’ve never tried removing only one team…

However if you want to hide all the teams like I have then this works. Otherwise oof :frowning:

1 Like

I don’t like using TeamColor because if I change the color of the team (for aesthetic purposes), I’ll have to change this value everywhere. It makes more sense to me to do player.Team == game.Teams.SomeTeam rather than player.TeamColor == BrickColor.new("Some Weird Color Name")

Then you could use a RemoteFunction to get the team from the server.

But you wouldn’t need to change the color in the first place if the player never saw it.

True, but it still is weird to refer to a team solely by an arbitrary color and makes code sort of unreadable for people looking at the code in the future.

I guess a good solution now could be to unparent the team from the TeamService and store a reference to the unparented teams in a module script. However I’m wondering if Team:GetPlayers() would still work because it will be crucial if I want to display the players number of players in queue (as this is what I intend to do with internal teams I don’t want visible)

All of these have solutions if you think outside the box a bit… For example, instead of using Team:GetPlayers() locally you could do:

function GetPlayers(teamcolor)
  local players = game.Players:GetPlayers()
  local teamplayers = {} --Players to return.
  for i = 1, #players do
    if players[i].TeamColor == teamcolor then
      table.insert(teamplayers, players[i])
    end
  end
  return teamplayers
end

Or even just get the players from the server.

3 Likes