Script-Made frames inside of scrollingFrame become streched!

Title, heres a preview image of whats happening when I’m playtesting:

image

How do i fix this?

Inside of the scrolling frame is a UIGridLayout. This only happens whenever the scrolling frame becomes scrollable due to too many frames being added inside

2 Likes

Screenshot the properties of the UIGridLayout

2 Likes

image

1 Like

The appearance I mean… I reckon CellPadding and CellSize is the issue

1 Like

image

also if you need the ui controller script, i can happily give it

Use scale not offset for the CellPadding and CellSize

so {5, 0}, {5, 0}?

or am i wrong

Scale is relative to the size of your screen so 0-1. Just fiddle around with it till it suits your taste

and remove the offset’s, right?

1 Like

after trying like a million combinations, i see no progress, except for the scrolling becoming shorter, this is probably an issue with my script

image

What are the properties of the UIGridLayout now?

image

The cellpadding is the space between each item in the frame and the cellsize is currently occupying your entire frame. (Try {0.05, 0},{0.05, 0} for CellPadding and {0.3, 0},{0.3, 0} for CellSize)

i tried some configuration but this is the closest I’ve got to normal results
image
, what can i do?
also a line in my code updates the scrolling frame, i don’t know if this is needed but here it is

frame.NoobsScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, frame.NoobsScrollingFrame.UIGridLayout.AbsoluteContentSize.Y)

That is happening because CellSize in GridLayout is set to some scale for example {0, 150}, {0.4, 0} that 0.4 means 40% of all height of that scrolling frame - even that hidden part. To fix this your script needs to dynamically set the cell height to 40% of avaliable space. You can do that by reading ScrollingFrame.AbsoluteSize to get actual size visible of scrolling frame.

It would be something like that:

frame.NoobsScrollingFrame.UIGridLayout.CellSize = UDim2.new(0, 150, 0, frame.NoobsScrollingFrame.AbsoluteSize.Y * 0.4) -- 40% of visible height 

Keep in mind that you need to dynamically update the size when player resizes their game window.

1 Like

Remove it and lower the cell padding a lot

1 Like

Thanks to everyone who helped! Thank you TheLazyRaven, and Krzymen!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.