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

How do I position GUIs so they appear the same on any screen?

Asked by
acecateer 130
10 years ago

So perhaps I wanted to make a GUI that was in middle for any screen I would do {0.5,(Size's offset/2)},{0.5,(Size's offset/2)} But how do I make it so that I can make it any where on the screen and still be in the same spot for every monitor like if I wanted to scale it .3 on the screen rather then .5, Would I still do the Size's offset divided by 2? {0.3,(Size's offset/2)},{0.2,(Size's offset/2)} If not, what would I do?

2 answers

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

The Scale and Offset, as vectors, can just be added; thinking about why you are picking the values will help.

If you want the center of an object to be 35% along the horizontal and 10% down the vertical, then that position would be (0.35,0, .1,0).

If that object was supposed to be 120 pixels wide & tall, then from the center to the left & top edge would be sixty pixels (negative).

So its position, since position is to the top left, would be (0.35,-60,0.1,-60) and its size would be (0,120,0,120).


Hopefully this helps. Remember to try your game at a number of resolutions / window sizes to make sure it works on whatever devices you need to support. Positioning things with a mix of scale and pixels can cause things to have too much or too little space if you aren't being careful.

When possible, it's probably best most of the time to only position to the screen edge (with acceptable margins) or the horizontal / vertical center.

0
How do I know the pixels its supposed to be? Arti_BLOX 58 — 6y
Ad
Log in to vote
-3
Answered by 10 years ago

probably do waits like wait(23)

and make it be in areas or make multiple guis.

and for the waits do something like this

-- the script is inside the gui(s)

wait(1)
while true do
script.Parent.TextBox.Position = --what ever u want
 -- so on so forth

derp

0
Lol no, first you wouldn't use Position for GUIs you would use UDim2 and that wouldn't work, sorry. :c acecateer 130 — 10y
0
No use to take my rep down >:l KennyAtkins 0 — 10y

Answer this question