?How to center a gui in the middle of the screen and on your phone and tablet. Because it moves left and right.How?
While this question is not strictly scripting related, I struggled with this as well and so here is the answer.
If your size is defined with offset(the 2and and 4th numbers of a UDim2), you follow these steps: set the first number of the position to 0.5 and the second to the negative of half the X size. So if your GUI is 400 wide: UDim2.new(0.5,-200,0,0) would center it.
If your size is defined with scale(the 1st and 3rd numbers of a UDim2) it becomes a bit more math-heavy. Take 1 and subtract from it the X size then divide that number by 2. So if your X scale size was 0.4:
1-0.4=0.6 0.6/2=0.3
So you would need to set the X scale position to 0.3
Hope this helped. If you need any clarifications feel free to help.
Ya Gui's are a pain in the ###. But anyway one of the ways you can get it in the center is by making a setup script to set the position of the gui. If you want it dead center then just get the size of the screen from "ScreenGui.AbsoluteSize". To do this in a script try this
wait(2) xx=script.Parent.Parent.AbsoluteSize.X/2 yy=script.Parent.Parent.AbsoluteSize.Y/2 print(xx..yy) script.Parent.Position=UDim2.new(0,xx,0,yy)
So ya. Also the position of the gui isn't the center but rather the top left corner so. To fix this just get the Position.X of your gui and then divide it by 2 and then subtract from xx. Like so
wait(2) xx=script.Parent.Parent.AbsoluteSize.X/2-100/2 yy=script.Parent.Parent.AbsoluteSize.Y/2-100/2 print(xx..yy) script.Parent.Position=UDim2.new(0,xx,0,yy)
so ya hope this helped