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

How do I Position a GUI?

Asked by
Zerio920 285 Moderation Voter
9 years ago

What do I put in the coordinates so a GUI is at the top center of the screen? The way the coordinates work really confuses me.

4 answers

Log in to vote
3
Answered by
acecateer 130
9 years ago

I'm just the guy for you!

To have a GUI that shows up in the same spot for every screen you will need to use offset for size and scale and offset for positioning.

Always use offset for sizing: {0, 100}, {0, 100}

For positioning you will need to use both scale and offset. Scale is the percentage of the screen you want the gui to be at, offset puts an offset that will make the GUI appear the same on all screens.

To use offset correctly all you have to do is the size's offset divided by 2 negative.

Example (If the GUI's size's offset was 100 for both the x and y axis):

{0.5, -50}, {0.5, -50} This would make the GUI be in the middle of the screen no matter what screen size you have.

All you would have to do to make it on the top and middle of the screen is do

{0.5, -50}, {0,0}

0
Lol @Below, you basically just said what I said. acecateer 130 — 9y
Ad
Log in to vote
1
Answered by 9 years ago

This isn't anything to do with scripting but, I'll help anyways. Position normally goes like {0, 0}, {0, 0}. I never use the first number of each number set. 1 = 1 pixel. I hoped this helped, and for more information on "GUI's", click HERE or HERE, for more information on "Position's", click HERE

Log in to vote
1
Answered by 9 years ago

This isn't the place to ask, but the coordinates are for the top-left corner of the GUI.

X - (0, 0) Y - (0, 0)

X goes left to right, and Y goes up and down. The first number in the coordinate is kind of odd. 0 is the very left of the screen, 0.5 is the middle, and 1 is the right side of the screen. This never changes with varying window sizes, so it's very useful. The second number is more precise. It measures in pixels, so entering (0, 10) for X would place the GUI 10 pixels from the left of the screen. Technically, the second number is an offset number, because let's not forget the GUI coordinates always use the top-left corner as reference. So, if you wanted to center it on the top, this is the best way to do it.

X - (0.5, 0)

However, it will always be a bit to the right, because once again, top-left corner is used. So, use the second number (offset number) to put it into place. The number you use can vary based on your GUI's size. So if your GUI's width was 150, this position would suffice:

X - (0.5, -75)

The -75 moves the GUI to the left to correct the position. In case you didn't notice, just divide the width by two. Hope this helps!

Log in to vote
1
Answered by 9 years ago

You could always get the GUI studio plugin. That might help a lot.

Answer this question