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

How do I center a proportional GUI?

Lets say I want to keep a GUI proportional, not stretched, for the sake of an imageLabel.

If I use RelativeXX or RelativeYY to keep it proportional, It cannot stick to the center of the screen. This happens because it only refers to one side of the screen is used to center it, and it will only be centered .

Is there anything around this? Much like how HTML can center objects

1 answer

UDim2(x1,y2,x2,y2)

x1 and y1 are proportional without regard for the actual thing so a way to block this for a perfect thing is

UDim2.new(.5,newx,.5,newy) newx should be the size of the gui's width /2 newy should be the size of the gui's height /2

so

example

if the gui size is UDim2.new(0,100,0,300)

UDim2.new(.5,-100/2,.5,-300/2)

1 comment

0

I guess this is valid, but I'm looking for a solution that allows me to center only things that are Proportional, and go off of the percentage of the screen rather than pixels

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