The AutomaticCanvasSize does not seem to actually work.
I had to write a script that changes the canvas size based on the number of frames.
The script does work, but it is always a little off when the number of frames changes.
Here is that script:
local ScrollingFrame = script.Parent:WaitForChild("ScrollingFrame")
function GetFrames()
local Count = 0
for i, v in ipairs(ScrollingFrame:GetChildren()) do
if v:IsA("Frame") then
Count += 1
end
end
return Count
end
local TotalFrames = GetFrames()
ScrollingFrame.CanvasSize = UDim2.new(TotalFrames * .2676, 0, 0, 0)
print("ScrollingFrame.CanvasSize.X =", ScrollingFrame.CanvasSize.X)
Here is the test file if you want to look at the settings.
In order for AutomaticCanvasSize to work properly, you must also set the CanvasSize property of the ScrollingFrame to {0, 0}, {0, 0}. This is because if you have a pre-determined CanvasSize, it can’t automatically re-size it, as it already has a pre-determined size. If the size is not pre-determined ({0, 0},{0, 0}) then it can re-size appropriately.
There isn’t really a good explanation for it, its kind of just how Roblox GUI elements work.
I did download the file and it gave me those options. I don’t know why you don’t have them. I can’t think of any other solutions right now but I will let you know if I do.
When I set the UIListLayout direction to Vertical and wrap to True, delete the UIAspectRatioConstraint, and set AutomaticCanvasSize to XY in the ScrollingFrame, this is what I am able to do: