Hello, I am trying to make a script that positions my GUI into the centre of the screen (For all devices), but all have failed, anyone know how I could do this?
Do
script.Parent.AnchorPoint = Vector2.new(0.5,0.5)
script.Parent.Position = UDim2.new(0.5,0,0.5,0)
Did you mean Vector2.new ? I think you misspelled it
No, the script scales it to the middle, it will center it. That is why I used anchor point, to make 0,0 to be in the center, not the top left
Oh really, the anchor point is the center of the GUI? I never knew that thanks.
It scales to the middle because the gui’s anchorpoint is in the middle
Sure, yeah it just moves the center
In what way had your script not worked? Was it the activation of the script or the gui position being wrong?
Positioning just always wrong.
If it’s just the positioning, then @iamtryingtofindname’s script in post #2 should work fine.
Hey there!
The best way you could do that is by using this script -
GuiObject.Position = UDim2.new(.5, -50, .5, -50)
If you need to make the GUI equally scaled for all devices, then you will have to change the Offsets of the GUI objects to 0 and scale them.
Why are you using offset? That would only center it if the elements size is 100 by 100. So it is not reliable. Also, your post is very similar to mine, except less reliable.