I recently researched a way to “fix” UIListLayout, but I never found effective metadata, because I wanted to use “Scale” to serve different platforms without sacrificing the size of the “Frame”.
After breaking my head thinking about a method I managed to make this script that works perfectly: (for UIListLayout inside ScrollingFrame)
local Bases = workspace:WaitForChild("Bases")
for p = 1,#Bases:GetChildren() do
local Clone = script.Sample:Clone()
Clone.Name = "Number"..p
Clone.Stage.Text = "Number"..p
Clone.ButtonFrame.Button.Number.Value = p
Clone.Parent = ScrollingFrame
CanvaValue = Clone.Size.Y.Scale*(p+1)
ScrollingFrame.CanvasSize = UDim2.new(0,0,CanvaValue,0)
for i,v in pairs(ScrollingFrame:GetChildren()) do
if v.Name ~= "UIListLayout" then
v.Size = UDim2.new(1,0,Clone.Size.Y.Scale/CanvaValue,0)
end
end
end
And now I am trying to create a method for “UIGridLayout”, but I am not able to think of a mathematical form for that.
My current script:
local StartCellSizeX = FrameProducts.UIGridLayout.CellSize.X.Scale
local StartCellSizeY = FrameProducts.UIGridLayout.CellSize.Y.Scale
local CanvaValue = (StartCellSizeY+FrameProducts.UIGridLayout.CellPadding.Y.Scale)*(i/FrameProducts.UIGridLayout.FillDirectionMaxCells)
FrameProducts.CanvasSize = UDim2.new(0,0,CanvaValue,0)
FrameProducts.UIGridLayout.CellSize = UDim2.new(StartCellSizeX,0,StartCellSizeY/CanvaValue,0)
in the correction part of the frame size is working, but Cavansize I’m not getting
if anyone can help me with this, i would be very happy.
thanks for reading .