How do you adjust your UI elements so they adjust to size..?

I am trying to make a kill UI for when you kill someone, I have a script that will get the players name. The problem is if the name is shorter or longer how will the sword image adjust to the text length? If it is short there will be a HUGE gap in between the player name tag.

In this case I usually do the following.

For starters Ill put a UIListLayout in the Parent of the stuff, and set its FiilDirection property to Horizontal
image_2025-02-15_200243253
Then I would set the TextLabels LayoutOrder property to 1, so that way its always the second object in the list.

After that I would set the TextLabels AutomaticSize property to Y, what this means is that the TextLabel’s size will grow to fit its Text inside of it. Which can be useful in this case. After that everything should be working just fine.

If you need an example I put this together that you can check out.
ListExample.rbxl (61.6 KB)

Hope this helps!

1 Like

This really works well, the only thing is that I have a script that automatically sizes things for all devices since I am really bad at UI, and using this messes up the position of where the GUI is on the screen. If I remove it the GUI is still messed up. Anyway you can teach me how to size things properly…?

1 Like

the only methods I really use for scaling stuff is just using the scale property, unless that is that I am making like certain buttons, in that case I primarily use offset, as otherwise it gets to small on mobile devices.

Other than that, which it wasnt that related, I wouldnt know what to do, just mess around with it.

What you could also do is make it so the parent frames UIListLayout, its HorizontalAlignment is set to center, that way well, its centered

1 Like

What about positioning? The size is fine now but now it is at the left corner of the screen… lol

edit: nvm i figured it out

1 Like