AutomaticCanvasSize Drift When Adding Many Items to ScrollingFrame

Hey everyone,

I’m running into a strange issue with my ScrollingFrame, specifically related to AutomaticCanvasSize (or possibly something else).

My ScrollingFrame is set up with:

  • AutomaticCanvasSize: Y
  • CanvasSize: {0,0,0,0}
  • ScrollingDirection: Y

Here’s the problem:
When I duplicate the item inside the ScrollingFrame a couple of times (2–3 duplicates), AutomaticCanvasSize works perfectly and adjusts to fit all items correctly.
But as I continue duplicating more and more copies, a slight sizing offset starts to appear. Over time, this offset compounds and eventually causes the last item to be pushed completely outside the visible area of the ScrollingFrame.

What’s strange is that the first few duplicates behave correctly, but the more items I add, the worse the gap becomes.

Example of correct sizing (just 1 extra object):

Example after many duplicates (scrolled to the bottom):

As you can see, that bottom gap gradually increases with more items added.

I’m stuck trying to figure out why this is happening or what’s causing the drift.

Thanks for your time!

Is the UI you’re working with 100% in pixels (other than like if the scale is 1 for fitting the parent frame, etc…)

AutomaticCanvasSize can only be used if the y-size of the scrolling frame is in pixels.

TBH too many people make their UI in scale but making it in pixels gives you more control.

Yes its in scale, which i think is what you mean by pixels. or is pixels like offset?

Yes. By pixels I mean offset.

To say it again, AutomaticCanvasSize set to Y will only work when the y size of the children are in offset NOT scale.

So you mean make the size of the objects within the ScrollingFrame in offset instead of scale, or the scrollingframe it self to offset instead of scale?

I mean the childrens’ size Y needs to be in offset.
But because that is in offset, everything else needs to be in offset.

So you basically have to resize the entire ScrollingFrame into offset (e.g., padding is now in pixels, so is list layout padding) and everything under that ScreenGui. Having everything in pixels actually makes it more scalable and you can use UIScale (instance) and script to scale all the UI

And as im using offset instead of Scale, i would use a UIScale with a script to handle scaling to different screen sizes?

Yes you would.

Code exmaple:

local originalSize = Vector2.new(1200, 800) -- Relative size of the screen you're using to edit the UI in studio
local camera = workspace.CurrentCamera
local uiScale = script.Parent.UIScale

local function update()
	local scale = camera.ViewportSize / originalSize
	uiScale.Scale = math.min(scale.X, scale.Y)
end

camera:GetPropertyChangedSignal("ViewportSize"):Connect(update)
update()

Yo i really, really appreciate your help and time. thank you!!

1 Like

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