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

Center of TextButton isnt 0.5 on scale value?

Asked by 4 years ago

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"?

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. XviperIink 428 — 4y
0
Oh, he already answered. RIP. NotedAPI 810 — 4y

2 answers

Log in to vote
0
Answered by
NotedAPI 810 Moderation Voter
4 years ago

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.

Ad
Log in to vote
0
Answered by 4 years ago

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

Answer this question