Whoops, I initially made this as a DM since I couldn’t post to Studio Bugs. I didn’t know that this DM would get turned into a thread. That’s pretty neat though.
Since I determined it was a studio bug, I’ve just been using a quick/easy workaround and thought I should share it for anyone else having this specific issue of ScrollingFrames not adjusting AutomaticCanvasSize properly with UILayouts/UIPadding.
local AllChildren = ScreenGUI:GetDescendants()
for i,v in pairs (AllChildren) do
if v:IsA("ScrollingFrame") then
if v:FindFirstChildOfClass("UIListLayout") or v:FindFirstChildOfClass("UIGridLayout")then
local Layout = v:FindFirstChildOfClass("UIListLayout") or v:FindFirstChildOfClass("UIGridLayout")
local function UpdateSize(FrameInstance,LayoutInstance)
if FrameInstance and LayoutInstance then
local PaddingX = 0
local PaddingY = 0
if FrameInstance:FindFirstChildOfClass("UIPadding") then
local UIPadding = FrameInstance:FindFirstChildOfClass("UIPadding")
PaddingX += UIPadding.PaddingLeft.Offset
PaddingX += UIPadding.PaddingRight.Offset
PaddingY += UIPadding.PaddingBottom.Offset
PaddingY += UIPadding.PaddingTop.Offset
if FrameInstance.AutomaticCanvasSize == Enum.AutomaticSize.Y then
FrameInstance.CanvasSize = UDim2.new(0,0,0,LayoutInstance.AbsoluteContentSize.Y + PaddingY)
elseif FrameInstance.AutomaticCanvasSize == Enum.AutomaticSize.X then
FrameInstance.CanvasSize = UDim2.new(0,LayoutInstance.AbsoluteContentSize.X + PaddingX,0,0)
elseif FrameInstance.AutomaticCanvasSize == Enum.AutomaticSize.XY then
FrameInstance.CanvasSize = UDim2.new(0,LayoutInstance.AbsoluteContentSize.X + PaddingX,0,LayoutInstance.AbsoluteContentSize.Y + PaddingY)
Layout.Changed:connect(function() UpdateSize(v,Layout) end)
v:GetPropertyChangedSignal("AutomaticCanvasSize"):connect(function() UpdateSize(v,Layout) end)
If you’re having the issue of ScrollingFrames AutomaticCanvasSize not calculating correctly with AutomaticSized descendants, I’ve found the only solution is to calculate the AbsoluteContentSize of all the ScrollingFrame’s children.
You could create a script to automatically calculate the AbsoluteContentSize by comparing AbsolutePositions and AbsoluteSizes between all of its children (which would be relatively straight forward but could be especially hard if you have any positional spacing since the spacing would need to be compared against each child’s AbsoluteSize/AbsolutePosition and could even require annoying conversions if using a mixture of scales and offsets).
I decided not to make that AbsoluteContentSize calculator since it would be very tedious to write and it’s much easier to just grab the already calculated AbsoluteContentSize from a UILayout with the script I posted above. But unfortunately that solution isn’t going to work for you if your use-case doesn’t utilize UILayouts.
You always could do some simple addition/multiplication if you know that the scrolling frame’s children aren’t going to be changing position and/or size but that would defeat the point of using AutomaticCanvasSize since you would end up setting it manually lol.