Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

How to make a GUI frame increase from middle outwards?

Asked by
trecept 367 Moderation Voter
6 years ago

I'm using tweenservice to tween GUI frame sizes to become larger, and I want it to be like a box that expands from all directions instead of just expanding from the corner outwards. Is there any simple way to achieve this?

1 answer

Log in to vote
2
Answered by 6 years ago
Edited 6 years ago

How to make a GUI frame increase from middle outwards?

The solution is actually really simple than you really think.

frame:TweenSize(UDim2.new(0, 400,0, 400), "Out", "Quad", 1)

You may be wondering..."But I did that. Well you forgot one of the neat features of Gui; AnchorPoints!

What are Anchor Points?

Anchor points acts as the origin points of the gui. Usually for every Gui, the anchor point is set to 0, 0 which is the default point. This option allows you to change the origin point to something else. By setting the anchor point to 0.5, 0.5, you are stating that the original point of the frame is the 0.5,0.5 thus, the above code starts from 0.5, 0.5

How to do so?

Go to your gui's properties. Set the AnchorPoint to 0.5, 0.5

Have a lovely day of coding!
Ad

Answer this question