I know that to center a GUI you would need to divide its pixel size in half.
So Size {0, 500} {0, 500} would need Position {0.5, -250} {0.5, -250}
But with Roblox going on mobile devices I would much rather use a screen percentage (the first number) to size and position my stuff. But then **how would I center the GUI if the size changes based on the screen resolution? **
Size: {0.5, 0} {0.25, 0} Position: {?, ?} {?, ?}
Do I need a script for this?
Quite simple actually. Just set the position to .5 - Half of size. Try this for position:
{.25,0}{.375,0}
If you have any quesitons, please leave a comment below. Hope I helped :P
If the gui size is being resized by the Scale, then there are 2 methods of positioning the Gui.
Method 1
Divide the scale by two to get the position property, like so:
Size: {0.5, 0}, {0.25, 0}
Position: {0.25, 0}, {0.125, 0}
Method 2
Use the traditional gui centering method by dividing and negating the AbsoluteSize
property of the Gui itself, like so:
Size: {0.5, 0}, {0.25, 0}
Position: {0.5, -Gui.AbsoluteSize.X / 2}, {0.5, -Gui.AbsoluteSize.Y / 2}
Hope this helped!