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

Would this be the center of the following Size of the Gui?

Size: {0.2, 0},{0.2, 0} Position: {0.4, 0},{0.4, 0}

2 comments

1

Yes.

0

Thx for the answer

1 answer

✓ Accepted answer

The center of a frame (e.g. the screen) is always {0.5, 0}, {0.5, 0} -- since 50% across vertically/horizontally is the middle.

The .Position of a GUI is always its top-left-corner.

The .Size o fa GUI is always the amount across from the left to the right and the top to the bottom. So half way through the GUI is .Size / 2

A GUI is centered in the view if its center is the same as the containing frame's center. Meaning that {0.5, 0} {0.5, 0} = .Position +``.Size / 2

If you want to figure out the position for a given size, then it's just this, through basic algebra:

Position = {0.5, 0} {0.5, 0} - Size / 2

So, for a size (0.2, 0, 0.2, 0) object, you need (0.5, 0, 0.5, 0) - (0.2, 0, 0.2, 0) /2 = (0.5 - 0.1, 0, 0.5 - 0.1, 0) = (0.4, 0, 0.4, 0)

1 comment

0

Thanks for explaining it! I used to know the formula, but I forgot all about it. lol.

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