|
| 21 Feb 2015 09:12 AM |
| I'm working on a game, but I encountered a problem. When I was playing my game on another computer, some guis weren't where they used to be. You see, on the computer I'm on right now, the guis are perfectly in the center of the screen, but on the other computer, it's slightly down and to the right. The monitor sizes are different, so I suspect that's to blame. Is there are way to have a gui always stay in the center of a screen, regardless of a monitor's size? |
|
|
| Report Abuse |
|
|
compy111
|
  |
| Joined: 02 Apr 2009 |
| Total Posts: 583 |
|
|
| 21 Feb 2015 09:20 AM |
GUI's use UDim for position and size.
A UDim has 4 numbers. The first is the x scale. The second is the x in pixels. Third is the y scale. And the fourth is the y in pixels.
If you set UDim.new(0,100,0,100) for a GUI it might show a small box on your PC but will become huge once you watch it on a tablet since the resolution is much smaller one that.
So if you want a GUI covering half of the screen you musn't use something like: 0,500,0,1000
You must use: 0.5,0,1,0
If you want to center it you need to set the position to: 0.25,0,0,0 |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2015 09:32 AM |
@Compy
Yes, that's what I'm using, but even if I do use that, it still changes on different monitors. I've seen other games with guis that should be where they are, so I'm pretty certain it's possible. |
|
|
| Report Abuse |
|
|
| |
|
|
| 21 Feb 2015 10:40 AM |
Make sure the Gui's inside of it also don't use Offset. If you want it centered, but maybe not the right size as a starting point, do this: Position: .5,0,.5,0 SIze: .25,0,.25,0 |
|
|
| Report Abuse |
|
|
compy111
|
  |
| Joined: 02 Apr 2009 |
| Total Posts: 583 |
|
|
| 22 Feb 2015 01:47 PM |
If you want a 10px box in the middle of your screen you need this:
size: 0,10,0,10 position 0.5,-5,0.5,-5
That should always be in the middle of the screen of any monitor. |
|
|
| Report Abuse |
|
|
|
| 22 Feb 2015 02:18 PM |
| Using the first number and 3rd number doesn't do anything... |
|
|
| Report Abuse |
|
|