I have a GUI, but I want to self-center it manually?
Simple... Use the formula:
Simplified Forumula (Offset only)
{0.5, -(width / 2)}, {0.5, -(height / 2)}
General Formula (scale and offset)
{0.5 - (xScaleSize / 2), -(xOffsetSize / 2)}, {0.5 - (yScaleSize / 2), -(yOffsetSize / 2)}
If you are using scale (which you should be using, so that the GUI appears the same on all screens), use the following code:
local GUI = Game.StarterGui.ScreenGui.Frame --Change this to the path to your GUI local x, y = GUI.X.Scale, GUI.Y.Scale GUI.Position = UDim2.new((1-x)/2, 0, (1-y)/2, 0)
Alternatively, if you are using offset (which could mess the GUI up on smaller screens) then use this:
local GUI = Game.StarterGui.ScreenGui.Frame --Change this to the path to your GUI local x, y = GUI.X.Offset, GUI.Y.Offset GUI.Position = UDim2.new(0.5, -x/2, 0.5, -y/2)
Marked as Duplicate by TofuBytes and BlueTaslem
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?