Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Centering a Button in a GUI?

Asked by
iNicklas 215 Moderation Voter
9 years ago

Ok, so i have this gui, the button is {0, 250},{0, 50}

What is the middle position? It is offset, you can test here.

http://www.roblox.com/games/255925361/Super-Meat-Blob-NEW-PROJECT

1 answer

Log in to vote
1
Answered by
ImageLabel 1541 Moderation Voter
9 years ago

The middle position would be UDim2.new(0.5, -size.X.Offset/2, 0.5, -size.Y.Offset/2).

size = size of object you are positioning, and not the parent GuiObject's size.

0
Now its just positioned far to the right? iNicklas 215 — 9y
0
You should be subtracting the size of the object you're editing, and not the parent's ImageLabel 1541 — 9y
0
The size.X.Offset/2 and size.Y.Offset/2 should be negative FearMeIAmLag 1161 — 9y
0
funny how I said subtract yet never actually did... Thank you @Fear ImageLabel 1541 — 9y
View all comments (2 more)
0
{0, 550},{0.5, 0} its positioned like this, and its right in the center. iNicklas 215 — 9y
0
It doesn't matter where the parent is positioned, you need to know the size of the object you want to center.. if the object is a direct descendant of a ScreenGui, all you need to to is set it to (0.5, 0, .05, 0) ImageLabel 1541 — 9y
Ad

Answer this question