I'm trying to make a scrolling frame that automatically sizes itself so the items inside fit but the items inside get bigger. I know the problem but I don't know how to fix it, does anyone else know what to do? Here's my code if it helps:
grid:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
local absoluteContentSize = grid.AbsoluteContentSize
scrollingFrame.CanvasSize = UDim2.fromOffset(0, absoluteContentSize.Y)
scrollingFrame.CanvasPosition = Vector2.new(0, absoluteContentSize.Y)
end)

14 comments
I tried this but it doesn't fix anything for me it just spaces out the frames again
oohh waait, why are you setting CanvasPosition? Just set the CanvasSize, remove line 5. Make sure to not remove the UIAspectRatio tho, without it nothing will work
It's the canvas size that stretches my frames though :/
The canvas position doesn't affect anything but the position the canvas is at.
so what's happening to the items inside, they are spacing out or they are getting bigger? or both? UIAspectRatio prevents them from being bigger so that should not be a problem, so are they then spacing out? how exactly does that look?
With the aspect ratio inside of the frames the frames then space out.
Also I'm using scale.
can you make a picture of how exactly does the 'spacing out' look?
No, but the longer the canvas size on the Y the more the frames space out on the Y
Space out in your case is that they have huge gaps or they are too big on Y? I don't know exactly what space out is sry. If they are stretched then you can only use UIAspectRatio to fix that, it will prevent them from stretching. You can change other properties of the AspectRatio to fit with your frame.
The padding needs to be lower but I don't know how to do that.
aha i got you, it has to do something with the UIAspectRatio. Basically you need to adjust grid size in UIGridLayout to fix that, it's very bad i know, you can also switch to offset size grid if it's that bad.
The problem is that AspectRatio forces the size while UIGridLayout does not want that so they create this, just a little lowering size of GridLayout X or Y (Just randomly playing with it) might help in this situation. - Offset size might be the best, it will look bigger for smaller phones which is good for them but might cause bad left or right padding (Best to set UIGridLayout to Horizontal Cente
That's not the problem, I just fixed my code by putting it in a local script. Thank you anyways.