UI Layouts problem

So, I’m creating a player list, and I wanted to categorize players according to their teams.

I tried doing it by making each team a separate frame, and just adding the players as children of that team frame.

image

image

But the problem is, when UIListLayout sorts the frames, it doesn’t add their children into their size, and therefore the Player’s frame collides with the team title of the next team.

What would be a good way to deal with this problem? :face_with_raised_eyebrow:

1 Like

Make your base frame the size of your entire team. The title of the team, and each players name will be embedded into this main frame, scaled properly to fit into this big frame. Then, it will be sorted well. If you want to sort the values in the team, you could add a additional list layout inside the base frame.

2 Likes

Just to let you know, I wouldn’t include spaces on the frames’ names; it’s generally regarded as bad practice across programming frameworks.

Personally, I would use ZIndex to solve this issue. I would have the second Team title within the Team 1 player name, but have all player names in Team 1 ZIndex as 1, and have the second Team title as ZIndex 2. Also with this, I’d have the player names in Team 2 as ZIndex 3.

Personal opinion though, something could be better.

For organisational purposes, I’m going to stick to @REALTimothy0812 's solution.

Why? I don’t see how it’s a bad practice.

Using code, you can set the base frame’s size using the AbsoluteContentSize property on the UIListLayout. That might make the approach laid out by @REALTimothy0812 easier to implement.

Additionally, if you don’t need to be able to do things like collapse player columns, what you can instead do is use a single list layout and insert the labels for each team into the list in appropriate indexes.

You might come across a corner-case where you might need to reference any of these objects directly using a command-line interface (i.e. the dev-console). Also, I’d like to keep at least some level of consistency through my objects’ names, so putting spaces just something I generally avoid doing altogether.

Everyone has personal preference. That doesn’t make it bad practice to use spaces. Also, you can use the developer console with spaces.

--Some random line of code
GuiObject['Name with spaces'].Text = 'It works'

I get that you want consistency for yourself, but for @tankattack9 spaces may be consistent. Really, it boils down to personal preference, not bad practice.

1 Like