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

How can I set my Frame in the center of the screen?

1 answer

✓ Accepted answer

There is a simple solution that I use to center a gui. I do

local size = script.Parent.Size
script.Parent.Position = UDim2.new(.5 - (size.X.Scale / 2), -(size.X.Offset / 2), .5 - (size.Y.Scale / 2), size.Y.Offset / 2)

What this does, is put the X axis to the middle, and subtract half of the size X scale, and the same for the Y axis.

But what you put in your question is different than what you put in the question title. So, to make the frame fill up the screen, do

script.Parent.Position = UDim2.new(0, 0, 0, -200) --to fill up Roblox's top bar thingy.
script.Parent.Size = UDim2.new(1, 0, 2, 0)

Hope this helps!!

2 comments

0

Also, the position is not the same as size. Setting the position does not set size.

0

Thanks. Sorry if I was unclear: I didn't want size, I already know that. I was just saying that it's easy to find out how to do it for size and uneasy to find out how to do it for position. But I know now, so lol

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