Alright, so I have a screengui in startergui, then a frame, then an imagelabel.
The imagelabel is this size:
{0, 100}, {0, 100}
So the way I learn it, 1 - 0.1 = 0.9 0.9/2 = 0.45
So I should put the position at..
{0.45 0}, {0.45, 0}
To centre it. Right?
Well it's not working, and it is a bit to the left of the centre.
The frame is at 1, 0 1, 0
So that shouldn't be an issue.
Am I doing something wrong?
If you want to center your gui on screen with the size {0, 100}, {0, 100}
, you should use the following formula for position:
{0.5, -(width / 2)}, {0.5, -(height / 2)}
{0.5 - (xScaleSize / 2), -(xOffsetSize / 2)}, {0.5 - (yScaleSize / 2), -(yOffsetSize / 2)}
In this case, it would be
{0.5, -50}, {0.5, -50}
A better way is to do something like this:
local gui = script.Parent local size = gui.AbsoluteSize gui.Position = UDim2.new(0.5, -size.X/2, 0.5, -size.Y/2)
it perfectly centers the Gui, and it will always be centered on every screen.
What would the position be instead of scripting the position. I have a button which moves and I want to know the position, so that I can position it to what the script is saying.