I made a script that automatically adds Text Buttons to a scrolling frame, but when a lot are added, the scrolling frame gets bigger. I expect it to not change size however make it so I can scroll through the buttons. Thank you.
Script:
local maps = script.Parent.maps:GetChildren()
local n = 0
for i = 1, #maps do
if maps[i]:IsA("Folder") then
local f = script.FormatOrganizer:Clone()
f.Position = f.Position + UDim2.new(0,0,0,50*n)
print(n)
f.Name = maps[i].Name
f.Text = maps[i].Name
f.Parent = script.Parent
n = n + .5
local secondary = maps[i]:GetChildren()
for o = 1, #secondary do
local c = script.FormatButton:Clone()
c.Position = c.Position + UDim2.new(0,0,0,50*n)
n=n+1
c.Name = secondary[o].Name
c.Text = secondary[o].Name
c.Parent = script.Parent
end
else
local c = script.FormatButton:Clone()
c.Position = c.Position + UDim2.new(0,0,0,50*n)
n = n+1
c.Name = maps[i].Name
c.Text = maps[i].Name
c.Parent = script.Parent
end
end
for p = 1, #maps do
local rev = maps[p]:GetChildren()
if maps[p]:IsA("Folder") then
for k = 1, #rev do
rev[k].Parent = script.Parent.maps
end
maps[p]:Destroy()
end
end
Normal:
With GUI’s added:
(The scroll wheel is also not appearing when lots are added)