for now my work around scrollFrameClass
ListScrollingFrameClass
local ListScrollingFrameClass = {}
ListScrollingFrameClass.__index = ListScrollingFrameClass
export type ListScrollingFrameInfo = {
FillDirection: Enum.FillDirection,
isDraggable: boolean?,
ScrollingSensitivity: number?,
isScrollBarAlwaysShown: boolean?,
AutomaticCanvasSize: Enum.AutomaticSize?,
ScrollingDirection: Enum.ScrollingDirection?,
MaxSizeOnFillAxis: number?,
MinSizeOnFillAxis: number?,
AutoSyncBackgroundColor: boolean?,
BackgroundTransparency: number?,
Padding: UDim?,
HorizontalAlignment: Enum.HorizontalAlignment?,
VerticalAlignment: Enum.VerticalAlignment?,
SortOrder: Enum.SortOrder?,
}
function ListScrollingFrameClass.new(info: ListScrollingFrameInfo)
assert(info.FillDirection, "FillDirection is required")
local self = setmetatable({}, ListScrollingFrameClass)
local isHorizontal = info.FillDirection == Enum.FillDirection.Horizontal
local maxSize = info.MaxSizeOnFillAxis or math.huge
local minSize = info.MinSizeOnFillAxis or 0
local isScrollBarAlwaysShown = info.isScrollBarAlwaysShown or false
local isDraggable = info.isDraggable or false
local scrollSensitivity = info.ScrollingSensitivity or 1.3
local scrollingFrame = Instance.new("ScrollingFrame")
scrollingFrame.Size = if isHorizontal
then UDim2.new(0,minSize,1,0)
else UDim2.new(1,0,0,minSize)
scrollingFrame.BackgroundTransparency = info.BackgroundTransparency or 1
scrollingFrame.ScrollingEnabled = isScrollBarAlwaysShown
scrollingFrame.CanvasSize = UDim2.fromScale(0,0)
scrollingFrame.ScrollingDirection = info.ScrollingDirection or Enum.ScrollingDirection.XY
scrollingFrame.AutomaticCanvasSize = info.AutomaticCanvasSize or Enum.AutomaticSize.XY
if info.AutoSyncBackgroundColor then
local function UpdateBackgroundColor()
scrollingFrame.BackgroundColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.MainBackground)
end
scrollingFrame.BackgroundTransparency = 0
self._themeChangedConnection = settings().Studio.ThemeChanged:Connect(UpdateBackgroundColor)
UpdateBackgroundColor()
end
if isDraggable then
local initPos = nil
self._dragConnectionBegan = scrollingFrame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
initPos = input.Position
end
end)
self._dragConnectionEnded = scrollingFrame.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
initPos = nil
end
end)
self._dragConnectionChanged = scrollingFrame.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
if not initPos then return end
local delta = input.Position - initPos
local dragVector = if isHorizontal
then Vector2.new(delta.X * scrollSensitivity, 0)
else Vector2.new(0, delta.Y * scrollSensitivity)
scrollingFrame.CanvasPosition -= dragVector
initPos = input.Position
end
end)
end
local layout = Instance.new('UIListLayout')
layout.FillDirection = info.FillDirection
layout.HorizontalAlignment = info.HorizontalAlignment or Enum.HorizontalAlignment.Left
layout.VerticalAlignment = info.VerticalAlignment or Enum.VerticalAlignment.Top
layout.SortOrder = info.SortOrder or Enum.SortOrder.LayoutOrder
layout.Padding = info.Padding or UDim.new(0, 0)
layout.Parent = scrollingFrame
local function OnAbsoluteContentSizeChanged()
local contentSize = layout.AbsoluteContentSize
local currentSize = if isHorizontal then contentSize.X else contentSize.Y
local constrainedSize = math.clamp(currentSize, minSize, maxSize)
if isHorizontal then
scrollingFrame.Size = UDim2.new(0, constrainedSize, 1, 0)
else
scrollingFrame.Size = UDim2.new(1, 0, 0, constrainedSize)
end
if not isScrollBarAlwaysShown then -- its flickering if newContentSize not used which is same as oldContentSize
local newContentSize = layout.AbsoluteContentSize
local newCurrentSize = if isHorizontal then newContentSize.X else newContentSize.Y
scrollingFrame.ScrollingEnabled = newCurrentSize > maxSize
end
if self.OnSizeUpdated then self.OnSizeUpdated(constrainedSize, contentSize) end
end
self._sizeChangedConnection = layout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(OnAbsoluteContentSizeChanged)
self.OnSizeUpdated = nil
self.scrollingFrame = scrollingFrame
self.layout = layout
self.childCount = 0
return self
end
function ListScrollingFrameClass:GetFrame()
return self.scrollingFrame
end
function ListScrollingFrameClass:GetChildCount()
return self.childCount
end
function ListScrollingFrameClass:AddChild(guiObject: GuiObject)
guiObject.LayoutOrder = self.childCount
self.childCount += 1
guiObject.Parent = self.scrollingFrame
end
function ListScrollingFrameClass:ClearChildren()
for _, child in ipairs(self.scrollingFrame:GetChildren()) do
if child:IsA("GuiObject") and child ~= self.layout then
child:Destroy()
end
end
self.childCount = 0
end
function ListScrollingFrameClass:BindOnSizeUpdated(customFunction: (constrainedSize: number, contentSize: Vector2) -> ...any)
self.OnSizeUpdated = customFunction return self
end
function ListScrollingFrameClass:Destroy()
if self._themeChangedConnection then
self._themeChangedConnection:Disconnect()
end
if self._sizeChangedConnection then
self._sizeChangedConnection:Disconnect()
end
if self._dragConnectionBegan then
self._dragConnectionBegan:Disconnect()
end
if self._dragConnectionEnded then
self._dragConnectionEnded:Disconnect()
end
if self._dragConnectionChanged then
self._dragConnectionChanged:Disconnect()
end
self.scrollingFrame:Destroy()
-- Clear references
table.clear(self)
end
return ListScrollingFrameClass
this is for plugin but probably works for im game purposes if nothing goes wrong 
i event include dragging system!
here is the plugin!
AutoResizeFrameTest.rbxmx (10.1 KB)
if you want to explore more about the setup of plugin drag and drop the file on explorer
and select the anchestor script named “AutoResizeFrameTest” then right click save as local plugin!
hope it helps