Frame not fiting in ScrollingFrame

I have a problem related to the position and size of objects within a scrolling frame.
How do I fix it?

Studio

InGame

My localscript:

for i, Frame in pairs(SettingsFrame.SettingsBackg.ScrollingFrame:GetChildren()) do
		if Frame:IsA("Frame") then Frame:Destroy() end
	end
	
	for iterator, set in pairs(SettingsModule) do
		print(iterator,set)
		local SettingHandler = script.SettingHandler:Clone() SettingHandler.Name = tostring(iterator) SettingHandler.Parent = SettingsFrame.SettingsBackg.ScrollingFrame
		SettingHandler.DesignedToText.Text = iterator
		SettingHandler.Description.Text = set.Description
		SettingHandler.LayoutOrder = set.LayoutOrder
		
		if SettingsModule[SettingHandler.Name].Enabled == true then 	
			SettingHandler.OnOff.BackgroundColor3 = ON_Color
			SettingHandler.OnOff.Text = "On"
		else
			SettingHandler.OnOff.BackgroundColor3 = OFF_Color
			SettingHandler.OnOff.Text = "Off"
		end
		
		SettingHandler.OnOff.MouseButton1Click:Connect(function()
			SettingsModule[SettingHandler.Name].Enabled = not SettingsModule[SettingHandler.Name].Enabled
			print(SettingsModule[SettingHandler.Name].Enabled)
			
			if SettingsModule[SettingHandler.Name].Enabled == true then 	
				SettingHandler.OnOff.BackgroundColor3 = ON_Color
				SettingHandler.OnOff.Text = "On"
				
			else
				SettingHandler.OnOff.BackgroundColor3 = OFF_Color
				SettingHandler.OnOff.Text = "Off"
			end
			
			print(SettingHandler.Name)
			
			ToSendFunction = SettingHandler.Name
			
			if ToSendFunction ~= nil then
				HandlerModuleSettings[SettingsModule[SettingHandler.Name].funcName](LocalPlayer,ToSendFunction)
				ToSendFunction = nil
			end
		end)
		
		SettingsFrame.SettingsBackg.ScrollingFrame.CanvasSize = UDim2.new(0,0,0,SettingsFrame.SettingsBackg.ScrollingFrame.UIGridLayout.AbsoluteContentSize.Y)

1 Like

Are the elements inside the frame also sized in Scale and not Offset?

1 Like

they’re sized with offset and have a UiAspectRatio preseted.

they are set as offset because at the end of the script only the fourth offset parameter is used to define the size of canvasSize.Y.Offset
(btw i’m using this method cause don’t have any idea how to set it to scale)

1 Like

There’s a plugin that can convert automatically from offset to scale

It’s because the buttons come from a loop, there is a module that has the necessary information to appear in the UI. The problem is that the buttons are not the same size and the canvas size is not proportional to the UI.

if the buttons are their own frame then i recommend putting the buttons inside an invisible frame (or u can make it visible if u want) and set it to scale instead of offset and addind the UIAspectRatio. Extra tip: set the frame’s anchor point to: 0.5, 0.5 and go to position and change it to 0.5, 0, 0.5, 0 and from there edit the position so u can move it to the position u like.

1 Like