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

How to have a GUI in the same place for everyone?

Asked by
Uroxus 350 Moderation Voter
9 years ago

(This may be a silly question, and I may have got this completely wrong but...)

This may have already of been asked, but I couldn't find it so I'll ask again. How do you have a GUI in the same place for everyone? Because everyone's screens are different sizes so they would be in different places for everyone??

Thanks =)

EDIT:

I asked my friend this question earlier today, and he came back with the simple answer of you use the first set of numbers in 'Position'. Meaning if my positioning was {0, 120},{0, 675}, then i'd simply replace the 0 next to it, with the 120 and 675 and replace those two numbers with 0 Making {120,0} {675,0} instead of {0, 120},{0, 675}, Is this true?? I would test but I dont have 2 computers with different sizes screens...

1 answer

Log in to vote
2
Answered by 9 years ago

Every GUI has a property named Position and Size. Position and Size are divided into two categories, the X and Y axis. The axes are divided into two more categories, the Scale and Offset. Scale (the first number) resizes the GUI based on the percentage of the screen from a scale of 0 to 1, and Offset (the second number) uses pixels. The Size and Position are organized as (X-Scale, X-Offset, Y-Scale, Y-Offset).

Position

Let's say we want our GUI to be dead center in the middle. We would edit the Scale so that it is 0.5 (50% of the screen). This gives us a position of (0.5, 0, 0.5, 0). (NOTE: When centering GUIs, always remember that the top-left corner of the GUI is used as the reference point.)

Size

Let's say we want out GUI to span across the screen horizontally but take up half the screen vertically. We would edit the scale so that the X-Scale is 1 (100% of the screen) and the Y-Scale is 0.5 (50%).

If this was unclear, just ask me a question and I'll edit my response. If you thought my answer was helpful, you can upvote and accept it. I hope it helped!

Example

Some people use the Scale for size and position while others use Offset. It's a matter of preference. Personally, I use Scale all the time because it adapts to all screens. But let's assume that you want to use Offset for your GUI. Let's use the second GUI for demonstration. First, set the GUI's position to the bottom-right corner. It's not as simple as changing the Scale for Position to 1 because the GUI measures from the top-left corner and your GUI will end up outside the screen! So we should use the Offset property to push it onto the screen. The GUI's size is {0, 250},{0, 50}, so the GUI's Position should be {1, -250, 1, -50}. You said you wanted to push it 10 pixels off the screen though. Just add (or subtract!) 10 to the offset to achieve this. The GUI's Position is now {1, -260, 1, -60}! Note that if you were using Scale to resize GUIs, you wouldn't use Offset. I hope this way easy to understand! It's kind of hard to explain in words.

EDIT

In response to your edit, no, you cannot swap the Offset and Scale and expect satisfactory results. Note that when using Scale, any numbers over 1 will not show up on the screen, because 1 = 100% of the screen. Assuming that you have knowledge of basic number to percentage conversions, setting the Scale to 120 will place the GUI at 12000% of the screen. The problem with this is self-explanatory. Same with 675, which would place the GUI at 67500% of the screen. The same applies to Size. As a reminder, 0.2 = 20%, 0.4, 40%, 0.75 = 75%, etc.

0
Thanks! Its kinda cleared it up a bit, But lets say, I want my GUI to be 10 pixels from the edge of the screen how am I supposed to do this?? Uroxus 350 — 9y
0
The simplest solution would be to set the offset to 10 or -10, depending on which side you want it to be 10 pixels from. However, position is measured from the TOP-LEFT corner, which means that you may have to edit the position in relation to size. Give me the size of your GUI and the desired position and I can help you with this. IcyArticunoX 355 — 9y
0
I actually have a series of GUIs as im trying to make a panel with all the information on (Fuel exc), The size of the first image is {0, 100},{0, 100} and the Gui that displays the amount of Fuel left is {0, 250},{0, 50} - But both of these are in the 'Offset' parts of the Guis..... This is confusing haha (And I wanted them to be a few pixels from the bottom right of the screen with the second Gui Uroxus 350 — 9y
0
Second Gui being next to it* Got cut off because it was too long haha Uroxus 350 — 9y
View all comments (5 more)
0
I edited my response to answer your question. I hope it helps! IcyArticunoX 355 — 9y
0
Yeah, that's made it clearer. Thanks for all your help man, much appreciated!! Uroxus 350 — 9y
0
No problem! :) IcyArticunoX 355 — 9y
0
I've edited my question with one last thing, Edited my question as Im not sure if it would fit here. Uroxus 350 — 9y
0
I've answered your question. I hope it helps! IcyArticunoX 355 — 9y
Ad

Answer this question