| |
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 24 Mar 2012 08:55 PM |
It's always:
For Scale: .5 - (GuiY/XSize/2)
Or: ScreenGui.AbsoluteSizeX/Y - (GuiY/XSize/2) |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2012 08:56 PM |
Well, I usually put it 650 X Offset
It should hit the middle, if not just fiddle with it xD
Hope you get it soon! |
|
|
| Report Abuse |
|
|
| |
|
Flurite
|
  |
| Joined: 03 Apr 2011 |
| Total Posts: 5386 |
|
|
| 24 Mar 2012 09:02 PM |
@1billybob1,
If you want it always positioned in the middle, no matter the size of the screen, use Scale for X and Y:
gui.Position = UDim2.new(0.5, 0, 0.5, 0)
Keep in mind that scale is a percentage, so 0.5 -> 50%, which is half-way-across on the screen. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 24 Mar 2012 09:02 PM |
@Flurite
That'll put the corner in the middle... |
|
|
| Report Abuse |
|
|
Flurite
|
  |
| Joined: 03 Apr 2011 |
| Total Posts: 5386 |
|
|
| 24 Mar 2012 09:04 PM |
@MrNicNac,
Oh yeah..
gui.Position = UDim2.new(0.5-(gui.Size.X*0.5), 0, 0.5-(gui.Size.Y*0.5), 0)
..I think that's right.. |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2012 09:06 PM |
| I don't need it in script though, so would it be: X - (0.5, 0) Y - (0.5, 0)??? |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2012 09:07 PM |
| I did that, and it's like 2 inches away from the exact middle. |
|
|
| Report Abuse |
|
|
Flurite
|
  |
| Joined: 03 Apr 2011 |
| Total Posts: 5386 |
|
|
| 24 Mar 2012 09:09 PM |
@1billybob1,
Try my last suggestion. |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2012 09:14 PM |
| Is there any way I can put it in the middle by typing it in the properties box? Instead of scripting it? |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2012 09:16 PM |
Why not use the command bar?
† KMXD † |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2012 09:17 PM |
| I did, it had error in output, (gui:1: attempt to index global 'gui' (a nil value) |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2012 09:18 PM |
Well you have to have a path to the Gui. . . Like game.StarterGui.WhateverUntilItIsTheGui
† KMXD † |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2012 09:19 PM |
| Now it says, Size is not a valid member of Screengui. |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2012 09:20 PM |
Size isn't a property of a GUI, go farther until you reach a frame or something.
† KMXD † |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2012 09:22 PM |
| Now it says, (:1: attempt to perform arithmetic on field 'X' (a userdata value) |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 24 Mar 2012 10:32 PM |
JUST
Subtract half the GUIs size from .5 |
|
|
| Report Abuse |
|
|
Flurite
|
  |
| Joined: 03 Apr 2011 |
| Total Posts: 5386 |
|
|
| 25 Mar 2012 07:31 AM |
@1BillyBob1,
We are not talking about the ScreenGui. If you want GUIs to be visible in the game, then you need to insert GUIs such as TextLabels, TextButtons, and all the others INSIDE the ScreenGui (parented under the ScreenGui). Then, you can set it's position in the middle of the screen using the sample code I gave you. |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2012 08:15 AM |
| gui.Position = UDim2.new(0.5,0,0.5,0)-(gui.Size/2) |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 25 Mar 2012 08:17 AM |
Can UDim2 support divides just like that :O I thought that you would need to -gui.Size.X.Scale/2.. etc |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2012 08:21 AM |
| I though it would work because you can do it with Vector3 :3 |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 25 Mar 2012 08:24 AM |
Hah.. I was right for once :PP
UDim2 is a userdata and you can't divide it :PP |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2012 08:26 AM |
| then why does it work with Vector3? O_o |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
| |
|