Strange Scrolling Frame, CanvasSize (NOT SOLVED YET)

I encountered a strange “ScrollingFrame” optimization.
In short, “UIListLayout” is very strange.

My code:

local scrollingFrame = ScrollUi
				local UIListLayout = scrollingFrame.UIListLayout

				scrollingFrame.CanvasSize = UDim2.new(0, UIListLayout.AbsoluteContentSize.Y, UIListLayout.AbsoluteContentSize.X ) -- This makes sure the scrolling frame is scaled when the game starts.

				local function onContentSizeChanged()
				print("Debug1")
					scrollingFrame.CanvasSize = UDim2.new(0, UIListLayout.AbsoluteContentSize.Y, UIListLayout.AbsoluteContentSize.X ) -- This makes sure the scrolling frame is scaled when ever there is something added into it during the game.
				end

				UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(onContentSizeChanged)

if someone can solve this problem that was very good

You shouldn’t need to change the CanvasSize like that. Just search in its properties for AutomaticCanvasSize and set it to Y.

3 Likes

You have canvas size in reverse, Y is setting X’s offset in pixels & X is setting Y’s scale.


but like 12345koip said, you shouldnt be using code


This works very strangely
I’ve already tried to do this

Try setting AutomaticCanvasSize for both X and Y instead of just Y.

From the very beginning I did this and that not work and the video shows the settings UIListLayout

Remove the scaling in the script. If you size it to {1, 0}{1, 0} and resize from there, it should scale automatically. Alternatively, just make sure the size is 1 or less (e.g. 0.634, 0)

Do this for all the descendants of the ScrollingFrame (obviously ignore the UIListLayout, etc.)

Also, are there any errors in the output?

I don’t understand what you mean

Basically, for the scrolling frame itself, and everything in it that has a Size property, make sure the size is less than or equal to 1. This will automatically scale it for all devices.