Children in Scrolling gui are too large, despite the size being extremely small

Hello, I recently created a ban list, and made a crappy one because I had no idea how to use scrolling guis, but today I decided to give it a shot. It extends as normal, adds it, but the buttons in it are extremely large compared to kme adding them in studio. even making the buttons size really small did make it smaller, but then they space out. Heres the localscript for you (sorry about indentation, I indent weird):

script.Parent.Parent.Parent.Parent.Dev.Banlist.MouseButton1Click:Connect(function()
	script.Parent.Script:WaitForChild("BanList",20)
		for i,v in pairs(script.Parent.Script.BanList:GetChildren()) do
		
		local txt = script.Parent.Parent.Parent.TexyButton:Clone()
		txt.Parent = script.Parent.Parent
		txt.TextSize = 18
		txt.TextScaled = false
		txt.Visible = true
		txt.Name = v.Name
		txt.Text = v.Name.." ("..game:GetService("Players"):GetUserIdFromNameAsync(v.Name)..")"
		local ls = script.LocalScript:Clone()
		ls.Parent = txt
		ls.Disbaled = false
		local ab = script.Parent.AbsoluteContentSize
		script.Parent.Parent.CanvasSize = UDim2.new(0,0,0,ab.Y)

	end
end)

I’m not sure based on the information you show what your values are for the size of your TextButton but one problem with scrolling frames is that when you set their CanvasSize property, any children who use the Scale portion of the Size attribute will also be changed.

What I’m guessing is that this line: script.Parent.Parent.CanvasSize = UDim2.new(0,0,0,ab.Y) is making the ScrollingFrame to be larger than its initial size, meaning that the scale of the elements contained in it are making the elements increase in size proportionately.

I don’t usually use offsets for most UI elements but in scrolling frames I opt to set the Y value of the size to use offsets rather than scale for this reason.

1 Like

Thanks, turns out I swapped the offset and scale. Thanks!

1 Like