generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Game Design
Home Search
 

Re: How do I always have a GUI in the center of a screen?

Previous Thread :: Next Thread 
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
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 is not online. 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
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
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
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
21 Feb 2015 09:58 AM
bump
Report Abuse
IthacaMedia is not online. IthacaMedia
Joined: 25 Jan 2014
Total Posts: 1337
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 is not online. 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
whyOmustOitObeOme is not online. whyOmustOitObeOme
Joined: 29 Aug 2009
Total Posts: 15668
22 Feb 2015 02:18 PM
Using the first number and 3rd number doesn't do anything...
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image