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

How to keep guis the same position and size in all resolutions?

Asked by 6 years ago

Hello, I have tried using Scale, UIAspectRatio and Emulator to scale and position my guis, the thing is, in other resolutions its not really the case....

I don't know if this is a thing that can be solved with scripting and I do not know if this is the right place... I heard you can do that with scripting, but Idk..

Help, Suggestions please?

2 answers

Log in to vote
0
Answered by 6 years ago

It actually pretty easy. A UDim2 in the properties panel looks like this: {0, 0}{0, 0} The first set of brackets is the X position, the second is the Y. But why two sets of numbers? The first set is actually the percentage of the screen. Don't get it?

0 means 0(obviously)

1 means the whole screen(so if you put {1, 0}{1, 0}, it would mean the whole screen if used in the size property)

0.5 means half the screen, etc.

Getting it now? The second set of numbers is the offset, AKA the number of pixels. It is highly recommended to use the Scaling property of GUI UDim2 than the offset(at least I highly recommend it). So your size and positions should look like this {0.5, 0}{0.3, 0} instead of {0, 500}{0, 250} (just random measurements)

Try making all your GUIs using this. Let me know. Sorry if you already tried this, I'm just trying to help.

0
I don't think you understood my questions, I already said I have guis and such, other resolutions are not viewing the same view as me, because this is how roblox works, I have been trying using Emulator, UIAspectRatio and other to make it so. Arti_BLOX 58 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

Ok, this isn't too hard.

Let's say you want it to stay at the right and middle of the screen.

First, we need the size. Let's say the size is:

0.1,100,0.1,100

Now, for the position part, it's easier to show you than explain.

position = 0.03, -50, 0.5, -50

As you can see, the 2nd and 4th numbers are the 2nd and 4th numbers of the size, except divided in half, and put into the negatives.

This will make it to the left of the screen and in the middle for ALL screens.

alvinBLOX made a handy video showing on how to put it in the centre of the screen for all players, and he explains what I showed you a lot better:

https://www.youtube.com/watch?v=k8NP-dqByp4

If this helped, please put it as "answered". Thanks!

0
This is where Alvin is WRONG. You should use scaling for EVERYTHING: position and size. Then do his method but subtract the half of the scale. His method works but if you are on a small screen, the GUI will still be off screen because it's too big. DatOneRandomDude 69 — 6y
0
I am Alvin's Moderator, I know about the video. I wasn't talking about centering in the middle, I was talking about positioning a gui ANYWHERE in ALL resolutions. Arti_BLOX 58 — 6y

Answer this question