Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a GUI frame increase from middle outwards?

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

✓ Accepted answer

#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!

This discussion is preserved as it was. New answers, comments, and votes are closed.