How would i center a ScreenGui or anything within? Lets say i have a logo, and i want it to be at the CENTER of every players screen no matter what screen size/resolution. How would this be performed?
Not a request. More like... advice.
This isn't a scripting request, we're not making anything for you. :P
(For clarification, we only consider something a "request" when the asker (you, in this case) request us to write code for you without any effort put in on their to make the code first.)
When you center something, you want to set the Scale portions of the Position to .5, for both X and Y. This puts the top-left pixel of the GUI in the exact center of the screen.
To make this actually centered, you have to Offset the Position by half of the Size of the GUI.
For example:
function Center(gui) gui.Position = UDim2.new(.5, -gui.AbsoluteSize.X/2, .5, -gui.AbsoluteSize.Y/2) end
If the Size's components are odd, this results in a split pixel, so the GUI will be off center by a single pixel. Make sure the components are even to avoid this. :)
UDim2
's have four values: x.scale, x.offset, y.scale, and y.offset, where UDim2.new(0, 0, 0, 0)
is the top left corner. To center a GUI, use UDim2.new(0.5 , -X/2, 0.5, -Y/2)
where X is the x component and Y is the y component of the Absolute Size of the GUI to be centered.