How would I change the size of a ScrollingFrame based on the contents that it has?

So I would like to make a scrolling frame that when there are more stuff being added, it changes it’s size. So when you add like a hundred more Frame inside of it, it would get larger.

scrollingframe


I'm not sure how to make it.

Insert a UIGridLayout into the ScrollingFrame, and configure it to however you would like, then create a script in the same parent of the ScrollingFrame, like this:

local ScrollingFrame = script.Parent:WaitForChild("ScrollingFrame");
local UpdateTime = 0;
while true do
    ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, ScrollingFrame.UIGridLayout.AbsoluteContentSize.Y + 35);
    wait(UpdateTime);
end;