From what you’re trying to accomplish, I think your best bet is to use UIGridLayout, as that automatically maintains the size and position of any children objects in the GUI.
I recommend playing around with the CellPadding and FillDirection variables if you intend on using UIGridLayout.
The UIGridLayout wouldn’t scale, though. It’d just end up creating more horizontal rows, and the buttons would never scale down with the parent frame (if you aren’t using scale in their size).
@Blue101black I’m not sure what exactly your text issue is, could you explain it a bit further?
I think I fixed it just by putting in a UITableLayout. Didn’t need to change anything else, although just to improve the text space available I halved the horizontal text padding from 32 to 16.
When scalling and position texts, images, frames, etc… Use ONLY Scale and 0 on Offset. It can allow you to scale perfectly and you should not get this problem! If you have problems when correctly scalling, use plugin AutoScale GUI https://www.roblox.com/library/1496745047/AutoScale-GUI
For anyone who does not want to use a UITableLayout here is how you can do it with UIListLayout
local outerPadding = 16
local innerPadding = 8
-- create a window frame
local window = Instance.new("Frame")
window.Size = UDim2.new(0, 300, 0, 200) -- any size you like
-- give the window a outer padding (OPTIONAL)
local padding = Instance.new("UIPadding")
padding.PaddingTop = UDim.new(0, outerPadding)
padding.PaddingBottom = UDim.new(0, outerPadding)
padding.PaddingLeft = UDim.new(0, outerPadding)
padding.PaddingRight = UDim.new(0, outerPadding)
padding.Parent = window
-- create a row frame (its important that we set offset to padding)
local row = Instance.new("Frame")
row.Size = UDim2.new(1, innerPadding, 0, 36)
row.BackgroundTransparency = 1
row.Parent = window
-- create List Layout with the padding we want and parent to row
local layout = Instance.new("UIListLayout")
layout.FillDirection = Enum.FillDirection.Horizontal
layout.Padding = UDim.new(0, innerPadding)
layout.Parent = row
-- lets now make the columns
local columnAmount = 3
local scaleX = 1 / columnAmount -- 0.333
for index = 1, columnAmount do
local button = Instance.new("TextButton")
-- its important that we subtract padding from the size
button.Size = UDim2.new(scaleX, -innerPadding, 1, 0)
button.Parent = row
end
While iv shows you how to do it in Lua its possible to do directly within studio you just have to workout scaleX 1 / columnAmount