AutomaticSize not expanding background frame with content

So, I’m trying to make a UI that expands depending on the amount of content inside a frame. I tried using the AutomaticSize property, but it doesn’t work as I expected. I want the background frame to also expand with the amount of content, but the property doesn’t seem to work properly. I’m not sure if I need to code something for this or if it can be done just with properties.

1 Like

Its just odd property that never worked for me.
It probably does not work since you have object that overrides this behavior like UIListLayout

So you have to either get rid of it or use it’s logic like:

UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function():()
	local AbsoluteContentSize = UIListLayout.AbsoluteContentSize
	ScrollingFrame.CanvanSize = UDim2.new(1,0,0,AbsoluteContentSize.Y)
end)

For automatic size or anything to work… basically EVERYTHING has to be in pixels

It is in pixels already
AbsoluteSize.

Scale in Size is used to get the same size as the container’s proportions.

I mean to reply to the original post!

Also @Yarik_superpro AbsoluteSize is read-only.

5 posts were split to a new topic: CHAT : AutomaticSize not expanding background frame with content

2 Likes

Already tried, thats dont work.


I’m trying to do something like this, and this is what I achieved.

The closest solution I could find is to make the border image the container that resizes on the Y axis. Then you use background color3 for the inside.

The checkboxes, textlabels etc are all handled normally.

AutomaticSize works on some UI elements but has limitations I’ve ran into in the past.
This is a bit more flexible than using AutomaticSize, in my opinion.

local frame = script.Parent.Frame
local list = frame:WaitForChild("UIListLayout")

list:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
    frame.Size = UDim2.new(frame.Size.X.Scale, frame.Size.X.Offset, 0, list.AbsoluteContentSize.Y + 10)
end)

This came from notes from a few years ago, hope it still works.