🤠 howdy
i’m working on a UI system for a personal project. part of that project involves having a ‘bar’ of buttons.
i’d like the size of those buttons to dynamically adjust depending on things like the number of buttons, the container size, etc.
i’m using UIListLayouts, so Roblox handles the positioning, etc. this also (annoyingly) means that i have to deal with paaaaddddinnngggg. i have the aspect-ratio I want the buttons to be.
i can’t tell if i’m being dumb or what, but here’s the code i’ve already attempted:
local function calculateWidth(contentSize, containerSize, numButtons, padding)
local totalPadding = padding * numButtons
local accurateContentSize = Vector2.new(contentSize.x - totalPadding, contentSize.y)
local buttonSize = containerSize / accurateContentSize
return buttonSize
end
this doesn’t seem to work. any help is appreciated ![]()