-
What do you want to achieve?
I want to auto size a scrolling frame depending on how many items(gui elements) are in it. -
What is the issue?
I have no idea on how to do so -
What solutions have you tried so far?
I have tried using LayoutUtil v 2.0 and other scripts i found but all of them made my GUIelements tiny or just broke the entire GUI.
(I usually don’t copy scripts but I’m not good with GUI’s at all so this is kinda my only option)
(I’m using Scale on everything already and all the UIConstraints are set by the AutoScale Lite plugin)
Exactly what I’m looking for but doesn’t work for me, there wasn’t really any examples on a scrollFrame in the developer forum. I probably did something wrong.
I don’t understand what’s not working, the image looks OK to me. Or did I interpret your reply incorrectly?
Well I guess it works but I cant scroll down since the scrollBar isn’t appearing, my bad for not explaining properly.
CanvasSize isn’t changing either.
That’s strange. Can you still scroll down?
only if I manually change the canvasSize
The only thing I can think of is ScrollingEnabled
being false - is it enabled?
Is it a Roblox bug?
Because it has always been enabled.
Ill try looking for more scripts online
After looking thru like 5 pages of google I found some old school Roblox website where someone posted this script
local ScrollingFrame = script.Parent
ScrollingFrame.CanvasSize = UDim2.new(0, ScrollingFrame.UIListLayout.AbsoluteContentSize.X, 0, ScrollingFrame.UIListLayout.AbsoluteContentSize.Y)
Which updates the size depending on the list absolute size
So I made it to update everytime the absoluteSize changes
local ScrollingFrame = script.Parent
ScrollingFrame.UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
ScrollingFrame.CanvasSize = UDim2.new(0, ScrollingFrame.UIListLayout.AbsoluteContentSize.X, 0, ScrollingFrame.UIListLayout.AbsoluteContentSize.Y)
end)
It’s better to just set the scrolling frame’s canvas size to UDim2.new(0, 0, 0, 0)
and its automatic canvas size to ‘X’, ‘Y’ or ‘XY’.
This has always worked for me.