How to fit the gui Scroll Bar with the items inside it?

I want the scrolling frame’s scroll bar to fit with the number of items inside it

When the items inside the frame increases, the Scroll Bar gets longer with the items. I’ve tried to create a system down below, might be calculating it wrong

Any help will be very much appreciated

while wait() do
		local items = #sf:GetChildren()
		local newYSize = items * .1
		sf.CanvasSize = UDim2.new(0, 0, newYSize, 0)
		ui.CellSize = UDim2.new(.45, 0, (newYSize * .2), 0)
	end

You could try the AutomaticCavasSize property in the scrollingFrame. Play around with that and it should work. Be sure to disable the script so that it doesn’t interfere. Also you should probably not use a loop to check whether a item has been added instead use :GetPropertyChangedSignal and have it check the absolute size.

2 Likes

thx a lot, bro u are a lifesaver

1 Like