wvvvJoin Date: 2015-01-24 Post Count: 192 |
x and y |
|
|
wvvvJoin Date: 2015-01-24 Post Count: 192 |
ok this was a dumb post
i should have included im trying to find the middle of the screen so when my gui appears its smack in the middle, this means answers could confused gui coordinates with vector3 coordinates
also .5 isnt working unless im doing something wrong |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
local GUI = your GUI
.5-GUI.Size.X.Scale/2, -GUI.Size.X.Offset/2, .5-GUI.Size.Y.Scale/2, -GUI.Size.X.Offset/2 |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
sorry
GUI.Size = UDim2.new(.5-GUI.Size.X.Scale/2, -GUI.Size.X.Offset/2, .5-GUI.Size.Y.Scale/2, -GUI.Size.X.Offset/2)
i think this was how you did it |
|
HeIixJoin Date: 2013-01-19 Post Count: 253 |
say you have a gui that you size UDim2.new(0, 100, 0, 100) so 100 by 100 pixels
then if you want it in the middle of your screen you'd do
gui.Position = UDim2.new(.5, -50, .5, -50) -- take half of the size, then subtract
the position is where the upper left corner of the gui is located at, not the middle of the gui
|
|
wvvvJoin Date: 2015-01-24 Post Count: 192 |
@frost, helix
ty for helping
i figured there was a problem but i couldnt wrap my head around it
i'd ask why i couldnt get an origin but my head was frying
ill try these solutions |
|
wvvvJoin Date: 2015-01-24 Post Count: 192 |
"gui.Position = UDim2.new(.5, -50, .5, -50) -- take half of the size, then subtract"
i made progress and i understand it, not sufficiently though. i dont understand how you're getting .5 from 0 when you cant divide or get anything from 0. and you're dividing then subtracting by what you get? im sorry if this is foolish my mind isnt working AT ALL today.
textLabel.Position = UDim2.new(.5, 75, .5, 25)
textLabel.Size = UDim2.new(0, 150, 0, 50)
this is my answer but im only understanding a little |
|
chimmihcJoin Date: 2014-09-01 Post Count: 17143 |
AnchorPoint AnchorPoint AnchorPoint AnchorPoint AnchorPoint
AnchorPoint AnchorPoint AnchorPoint AnchorPoint AnchorPoint
AnchorPoint AnchorPoint AnchorPoint AnchorPoint AnchorPoint
AnchorPoint AnchorPoint AnchorPoint AnchorPoint AnchorPoint
AnchorPoint AnchorPoint AnchorPoint AnchorPoint AnchorPoint
AnchorPoint AnchorPoint AnchorPoint AnchorPoint AnchorPoint
AnchorPoint AnchorPoint AnchorPoint AnchorPoint AnchorPoint
AnchorPoint AnchorPoint AnchorPoint AnchorPoint AnchorPoint
AnchorPoint AnchorPoint AnchorPoint AnchorPoint AnchorPoint
AnchorPoint AnchorPoint AnchorPoint AnchorPoint AnchorPoint
AnchorPoint AnchorPoint AnchorPoint AnchorPoint AnchorPoint
AnchorPoint AnchorPoint AnchorPoint AnchorPoint AnchorPoint
|
|
|
@chimmihc is right, but could've been a bit more helpful by giving you a Wiki link:
wiki.roblox.com/index.php?title=API:Class/GuiObject/AnchorPoint |
|
wvvvJoin Date: 2015-01-24 Post Count: 192 |
@willie
its abstract, im using a screenGui
my knowledge on scripting is amatuer too |
|
|
the way gui positioning works is that the 1st and 3rd numbers scale to the size of the screen
the top left corner is 0 and 0 in scale and the bottom right corner is 1 and 1, because that's the full size of the screen
the middle of the screen is 0.5 and 0.5 in scale, but because that positions the top left corner of the GUI, then the top left corner of the GUI will be in the middle and the GUI's center won't be in the middle
you can fix this either by using anchor points or you need to subtract half of the size of the gui
so if your gui is, say, 0.5 scale in width and height, then you'd have to position your gui at 0.25 in x and y scale for it to be positioned in the middle because 0.5 - (0.5/2) = 0.25 |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
im pretty sure i correctly told him the answer, did he try it |
|
wvvvJoin Date: 2015-01-24 Post Count: 192 |
@void
the question was solved |
|