How to make your own auto scale scrolling frame

Hello,

I recentlly wanted to make my own auto scale for scolling frame because roblox one doesnt work like I want it to. Here is example what I need it for and whats the problem with my current one that I tried to make:

Basically the ui is scrolling almost correclty but the issue is that the more it loads, the more gap it leaves at the bottom

other issue is that it should load on every device about the same so no gaps at the bottom (unless I want to add some pixels for texts or buttons at the very bottom)

Here is my current script: (its testing place)

local Canva = script.Parent.Reviews

local CanvasStartingAS = Canva.AbsoluteSize

print(CanvasStartingAS)

local function scaleCanvas()
	local FrameAS = Canva.Frame.AbsoluteSize.Y * 0.9
	
	Canva.CanvasSize = UDim2.fromScale(0, ((#Canva:GetChildren() - 2) * FrameAS) / (CanvasStartingAS.Y))
end

for i = 1, 150, 1 do
	local NewFrame = script.Frame:Clone()
	NewFrame.Parent = Canva
	NewFrame.BackgroundColor3 = Color3.fromRGB(math.random(1, 255), math.random(1, 255), math.random(1, 255))
	
	scaleCanvas()
	task.wait()
end

Thx for reading

1 Like

I’ve always had the same problem with scrolling frames. I found out that you can fix that by doing something really simple!

In the properties (of the scrolling frame), you’ll need to set AutomaticCanvasSize to Y and the CanvasSize to {0, 0},{0, 0} .

1 Like

but thats not really the problem I am having atm, the main thing is that when I use auto canvas then there is a delay between it detects that childs were added and it sometimes makes the scrolling bar bigger only if u get to the bottom. This couses loading frames to act weird because I load 10 at the time and check if you are at the bottom of the page before loading more. With auto cavas it detectes it many times and keeps loading frames so when you actually want to read something it moves your canvas position around and there is nothing I can do about it.

Thats why I need a custom system

ok nvm I’m just dumb, in ListLayout there is something called “AbsoluteContentSize” and you can use this

could you send the script that you made please seeing as im having the issue too

GameReviewer.Reviews.Reviews.CanvasSize = UDim2.fromOffset (0, GameReviewer.Reviews.Reviews.UIListLayout.AbsoluteContentSize.Y + 100)

I basically have a scrolling frame with UIListLayout and I Set Y in Udmi2 of CanvaSize to AbsoluteContentSize of this UIListLayout

Are you sure that this works on every device? Because if you are playing with offset, it might do something weird on mobile. (When you add 100 to the AbsoluteContentSize) I’ve tried something similar and it just scaled every frame each time one was added to the scrolling frame.

I am not sure but it works for me, and I add 100 to add some space at the bottom

I’m having the same issue on horizontal scrollingframes, it auto adjust but then at some point it stops and i can’t scroll further
image