Automaticly sizining a scrolling frame with UiGridLayout

so im making a player customization Gui, how ever i have ran into a problem when you add more accessories then the gui can fit. Im using UIGridLayout to layout every button nicely.

how could i automaticly resize the scrolling frame to fit all of the buttons?

if you need more information please ask.

Oh what do you mean? you making a scorning frame?

oh Iā€™m so sorry, I forgot to mention that, yes I meant to extend the scrolling frame canvas size

Can you send a image? Btw what part of it are you confused? Cause down in the ā€œCell Sizeā€ I thing is size of it an the padding I think is the gui between it.

Any UI Gird Style Layout element has a read-only property called AbsoluteContentSize. This property provides a Vector2 value that shows the size used by the UiGridLayout to fit all the GUI elements and the padding between elements.

And then you can use this Vector2 value to modify the ScrollingFrameā€™s CanvasSize. This value is a UDim2 Value but luckily on the API reference for AbsoluteContentSize has code for the exact reason of adapting the size of a Scrolling Frame.

UIGridStyleLayout.AbsoluteContentSize (roblox.com)

1 Like