Short answer
No
Long answer
Sort of, its hard to tell exactly what you want. Do you want a ScrollingFrame that truncates dynamically depending on its descendants? Cause that can be done.
But a ScrollingFrame with infinite CanvasSize is impossible, unless you get creative.
Dynamic ScrollingFrame
If the dynamic ScrollingFrame is what you want its actually quite easy. All you need to do is get the children of the ScrollingFrame and get their size and add them all together.
Ex. This truncates a ScrollingFrame that contains ui sorted by a UiListLayout vertically
local children = ScrollingFrame:GetChildren()
for i = 1, #children do
if not children[i]:IsA(any instance type you might want to avoid) then
local offset = offset + children[i].Size.Offset.Y
local scale = scale + children[i].Size.Offset.Y
end
end
ScrollingFrame.CanvasSize = UDim2.new(0, 0, scale, offset)
You will have to adapt this code to whatever you are working on
"Infinite" ScrollingFrame
You can create a pseudo-infinite ScrollingFrame by using a tillable background and resetting the position whenever the pattern matches.
Ex. the variables in this script can vary a lot. You will defiantly need to customize it.
local RunService = game:GetService("RunService")
local maxDistX = 100
local minDistX = -100
local maxDistY = 100
local mixDistY = -100
RunService:HeartBeat(function()
if ScrollingFrame.CanvasPosition.X >= maxDistX or ScrollingFrame.CanvasPosition.X <= mixDistX or ScrollingFrame.CanvasPosition.Y >= maxDistY or ScrollingFrame.CanvasPosition.Y <= mixDistY then
ScrollingFrame.CanvasPosition = Vector2.new(0, 0)
end
end)
Big ScrollingFrame
And in the end you could just set the canvas size to a huge number, but thats not really infinite.
Ex.
ScrollingFrame.CanvasSize = UDim.new(math.huge, math.huge, math.huge, math.huge)
2 comments
Test it out yourself
I did, that is why I asked the question here.