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 » Scripting Helpers
Home Search
 

Re: What is the exact middle of the screen for a Gui

Previous Thread :: Next Thread 
ScriptGuilder is not online. ScriptGuilder
Joined: 07 Aug 2014
Total Posts: 848
08 Oct 2014 11:07 PM
?
Report Abuse
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
08 Oct 2014 11:11 PM
x scale = 0.5
y scale = 0.5
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
08 Oct 2014 11:12 PM
adeep isn't being specific enough


size the GUI using offset, put 0.5 on both the x scale and y scale, and subtract divide the gui's AbsoluteSize.X by 2, and put the negative result in the x offset for position. then do the same for y
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
08 Oct 2014 11:14 PM
Good way to do this:

Get all of the side bars out of the way.. Search Free Models, Objects, Properties, and Explorer.. They offset the gui on your screen. Get those out of the way and it'll be much easier.. at lease for the x axis due to the y axis still being obscured by the top studio bar.
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
08 Oct 2014 11:24 PM
frame = game.StarterGui.ScreenGui.Frame

frame.Position = UDim2.new(.5,-frame,Size.X/2,.5,-frame,Size.Y/2)

paste this with the correct location to the gui you want to center into the cmd bar
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
09 Oct 2014 12:56 AM
local size = yourGui.Size
local center = UDim2.new((0.5 - (size.X.Scale / 2)), -(size.X.Offset / 2), (0.5 - (size.Y.Scale / 2)), -(size.Y.Offset / 2))
yourGui.Position = center
Report Abuse
powertool is not online. powertool
Joined: 01 Feb 2008
Total Posts: 3771
09 Oct 2014 12:58 AM
The exact middle for any ScreenGui is as follows:

path.to.gui.Size=UDim2.new(0,sizeX,0,sizeY)
path.to.gui.Position=UDim2.new(0.5,-(sizeX/2),0.5,-(sizeY/2))
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
09 Oct 2014 01:04 AM
@Power
No its not, not if the gui uses scale for size
Report Abuse
powertool is not online. powertool
Joined: 01 Feb 2008
Total Posts: 3771
09 Oct 2014 01:11 AM
It doesn't use scale for its size. That's very bad practice for anything that isn't trying to determine the screen size of the player.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
09 Oct 2014 01:14 AM
You don't know if OP is using scale for their gui

If you don't use scale, people with smaller screens (Particularly mobile devices, but also maybe just a small laptop) will have guis completely covering the screen
Report Abuse
powertool is not online. powertool
Joined: 01 Feb 2008
Total Posts: 3771
09 Oct 2014 01:29 AM
Hence why I design my GUIs to be positioned according to scale, but sized with offsets.

Hence why I design my GUIs on a 13" laptop (not a large one by any standards), hence why I design a separate mobile version.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
09 Oct 2014 01:58 AM
... Hence why it's not unreasonable practice to combine scale with offset in the size...
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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