How to make an auto expanding scrollingframe with UIGridLayout

I want to try to make a scrolling frame that will automatically expand with its children inside

Ive tried using this line of code:

game.Players.LocalPlayer.PlayerGui.GameGui.Inventory.ScrollingFrame.CanvasSize = UDim2.new(0, game.Players.LocalPlayer.PlayerGui.GameGui.Inventory.ScrollingFrame.UIGridLayout.AbsoluteContentSize.X, 0, game.Players.LocalPlayer.PlayerGui.GameGui.Inventory.ScrollingFrame.UIGridLayout.AbsoluteContentSize.Y)

The problem with this is that the padding is way too big between the different lines of the guis:
Processing: 2021-10-22 12-34-33.mkv…

I want to achieve something similar to:

2 Likes

There’s an AutomaticCanvasSize property for scrolling frames. Set it to Y.

1 Like

If this is true, I wasted my time writing an algorithm that adjusts canvas and grid sizes… :joy: ugh, thanks anyways, also good post OP.

1 Like