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

How do I center a proportional GUI?

Asked by 8 years ago

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

Log in to vote
1
Answered by 8 years ago

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)

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 randomsmileyface 375 — 8y
Ad

Answer this question