Button brings you to section in Scrolling GUI

Hello! I am trying to make tabs for my Robux Shop GUI, and when you click them it brings you to the tab like if you click the Game passes tab, it brings you to the Gamepass section in the Scrolling Frame. How can I do this?

Video on what I mean > 2021-10-12 16-53-22 (what I mean is when you click the button, it brings you to that section)

3 Likes

Theres a property CanvasPosition its a vector2 value you can Tween it if you want a nice transition or just set it to make it just snap it to the desired CanvasPosition

Example of setting it
ScrollingGui.CanvasPositon = Vector2.new(0,DesignedPosition) 

Resoruces

https://developer.roblox.com/en-us/api-reference/property/ScrollingFrame/CanvasPosition

3 Likes

I don’t need a fancy transition, I just want it to bring you to that section when you click on it.

1 Like

I did give you two options. Just choose the second…

1 Like

I don’t understand anything in there, how is that supposed to make it bring to a position in a scrollingframe?

1 Like

I will go into detail. CanvasPosition is a Vector2 value and a property of ScrollingFrame.

It is literally the position property for scrollingframes

Example

ScrollingFrame.CanvasPositon = Vector2.new(0,DesignedPosition) 
1 Like

I’m sorry but are there any videos on this? I am so lost…

1 Like

I think @Extrenious explained it pretty well. Move your scroll frame to the position you want it to and get the CanvasPosition property. Now once you have that when the button is clicked, simply do ScrollingFrame.CanvasPositon = Vector2.new(--Position)

1 Like

And all I have to do is put it inside a LocalScript in the button?

1 Like

Yeah, check when the button is clicked and move it accordingly.

1 Like

Within Test mode open your explorer tab and find the scrollingframe. Then open properties panel and when you scroll to the position you want it to snap to copy and paste the value. So you can type it in later.

GuiObject.MouseButton1Down:Connect(function()
ScrollingFrame.CanvasPositon = Vector2.new(0,DesignedPosition) 
end)
1 Like

My scrolling frame is called Passes, so would I change it to passes?

1 Like

You don’t need to change any names you just need to add in this line of code

ScrollingFrame.CanvasPositon = Vector2.new(0,DesignedPosition) 

To each button after you find the desired position for each

1 Like


I just get that error.

	ScrollingFrame.CanvasPositon = Vector2.new(0,300) 
end)
1 Like

It was example code. Don’t your buttons already work?

You need to define your buttons first

1 Like

Yes, but I am trying to do the Buttons on the side which bring you do that position in the ScrollingFrame

1 Like

Assuming your local script is a child of the button.

script.Parent.Activated:Connect(function()
   scrollingFrame.CanvasPosition = Vector2.new(--location)
end)

of course the scrollingFrame would be where your scrollingframe is.

1 Like

Didnt really understand what you meant there.

Still kind of lost by what you mean here.

Are your buttons already made? defined like have a variable and a MouseButton1Down event connected?

1 Like

I believe he has buttons, but not scripted.

1 Like

Whats the name of the ScreenGui this is located in?

1 Like