Trying to make my own scrolling frame but ui is clipping

I want to make my own scrolling frame because 1st, I want all the buttons to start from the center and to the right; 2nd, I want to only go scroll one button forward for every scroll input

I have mostly done this ^^ but the UI is clipping on the left of the screen.

robloxapp-20231120-0855292.wmv (1.7 MB)

I don’t know what’s going on cause I don’t work with UI much

--loading the levels onto the frame
function guiModule.loadLevels()
	local player = Players.LocalPlayer
	local screenGui = player.PlayerGui:WaitForChild("ScreenGui")
	for i, v in pairs(screenGui.LevelSelectPage.LevelsFrame:GetChildren()) do
		if v:IsA("Frame") and v.Visible == true then
	for i, v in pairs(Levels) do
		local frame = screenGui.LevelSelectPage.LevelsFrame.LevelTemplate:Clone()
		frame.Parent = screenGui.LevelSelectPage.LevelsFrame
		frame.Position = ((i-1)*.3)+(0.5-frame.Size.X.Scale/2)  ,0,0,0)
		frame.NameButton.Text = v.Name
		frame.Name = v.Name
		frame.Visible = true
local function ScrollAction(inputObj)
	if not hoveringToScroll then print(hoveringToScroll) return end
	local children = screenGui.LevelSelectPage.LevelsFrame:GetChildren()
	for i, v in pairs(children) do if v.Name == "LevelTemplate" then table.remove(children, i) end end
	local selectedIndex = guiModule.getLevelIndex(levelSelected)
	if inputObj.Position.Z == 1 and selectedIndex ~= #Levels then
		selectedIndex += 1
	elseif inputObj.Position.Z ~= 1 and selectedIndex ~= 1 then
		selectedIndex -= 1
	levelSelected = Levels[selectedIndex].Name
	for i, v in pairs(children) do
		local middle = (0.5-v.Size.X.Scale/2)
		local index = guiModule.getLevelIndex(v.Name)
		TS:Create(v, scrollInfo, {Position =*(index-selectedIndex),0,0,0)}):Play()
	print(levelSelected, selectedIndex)
--get level index
function guiModule.getLevelIndex(name)
	for i, v in pairs(Levels) do
		if v.Name == name then
			return i
--the levels
local Levels = {
		["Name"] = "Cadiz",
		["Prerequisite"] = false,
		["Name"] = "Granada",
		["Prerequisite"] = false,
		["Name"] = "Albacete",
		["Prerequisite"] = false,
	---and more(its too long)

sorry if I’m just dumping code on yall but please help me


I recommend you try using a UIGridLayout or UIPadding, and then set everything up as you wish.

1 Like

how do make it so it never go down?

I am going to try figure out how to use UIPadding

1 Like

You said it’s a scrolling frame, right? Put it into a scrolling frame and it should work.

1 Like

how do I make it so it only fills to the right and not down, in the picture above i set AutoCanvasSize to XY so I could show that the button went down

Also, when autocanvas size is to X it still goes down but you can’t scroll down.

1 Like

In the scrolling gui, I’m pretty sure there is a property that determines the way it scrolls, make sure its vertical.

1 Like

I had scrolling direction to XY.

I don’t want it to scroll vertically, I want it to scroll horizontally, but I tried it anyway

Setting scrolling direction to X had no effect.

You also can see that there are 4 Leveltemplates, one of them went down instead of continuing the pattern to the right

sorry that I keep repeating myself btw

1 Like

When Ill get back home I’ll try, so the issue is that theres no scroll bar or you can see the beginning of the next button or something else?

1 Like

The issue is that I want the UIGridLayout to only sort things to the right but it keeps moving it down.
like my picture

My original script placed them all instead of using a gridlayout only horizontally

1 Like

BTW this is the version of the game where i took the video, it does not have the UIGridLayout, it uses the script above.


1 Like
  1. UIListLayout works better.
  2. Set the thing at the left with higher ZIndex than the ScrollingFrame
1 Like

Tried UIListLayout but it wont start at the center.

I’m not sure what you mean by the thing at the left?

1 Like
  1. I mean the circle thing with “the thing at the left”
  2. Change the UIListLayout properties (VerticalAlignment to Enum.VerticalAlignment.Center)

Vertical Alignment = Center, Horizontal Alignment = Center
^^Cuts off

Vertical Alignment = Center, Horizontal Alignment = Left
^^Does not start at the center, I want it so the button in the center is the one you select.

Automatic Canvas Size is set to X

I dont work alot with UI’s so i unsure if this will work, but if you drag the UIListLayout to both edges of the screen, then use ZIndex to put the round things over the list?

Sorry for the late reply since I just got back. I am unsure what you mean by dragging the UIListLayout to both edges of the screen because it doesn’t have like a physical element, all it does is puts things in a list.

if you set HorizontalAlignment to Enum.HorizontalAlignment.Center?
or move the whole thing with UIPadding?

My bad, i meant frame. Make the Xaxis of the frame 1,0