Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Center of TextButton isnt 0.5 on scale value?

I made a simple GUI for my game to show some features it has in it, and i wanted the features to show up in the center of the screen; for some reason, the center wasnt the position {0,5,0,0,5,0}, it was something like 0.36/0.42; i could put it in the center but now its really just that im curious, why did the center value "change"?

2 comments

1

You need to change the anchor point of the gui to be .5,.5 and the position of the gui to be .5,0,.5,0. This will set the gui to be the center.

0

Oh, he already answered. RIP.

2 answers

✓ Accepted answer

Hey, Nuvem1000!

Set the AnchorPoint of the GuiObject that you were using to 0.5,0.5, and changing its position to 0.5,0,0.5,0 should make it go to the center.

The center wasn't the position because you didn't set the anchor points. Put {0.5, 0.5} in the object's anchor points then set the object's position, {0.5, 0, 0.5, 0}. Aside from center, anchor points can be really useful for GUI designing.

Remember if you set the object's anchor points set it to its same number but in scale, like for example:

AnchorPoints: 0.5, 0.5 Position: 0.5, 0, 0.5, 0

List of anchor points:

0, 0 | Top left (DEFAULT)
0.5, 0 | Top middle
1, 0 | Top right
0.5, 0 | Middle left
0.5, 0.5 | Center
1, 0.5 | Middle right
0, 1 | Bottom left
0.5, 1 | Bottom middle
1, 1 | Bottom right

To learn more about AnchorPoints: https://developer.roblox.com/en-us/api-reference/property/GuiObject/AnchorPoint

This discussion is preserved as it was. New answers, comments, and votes are closed.