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

What is the UDim2 Value for the absolute middle of the screen?

Asked by 6 years ago

I've been messing around with GUI's trying desperately to get a better understanding of them. I've been trying to get a GUI positioned in the middle of the screen, but it looks different in studio compared to in the real game. Does anyone know a value that is in the middle for studio and the real game?

1 answer

Log in to vote
0
Answered by 6 years ago

UDim2.new(0.5, 0, 0.5, 0) combined with an AnchorPoint of 0.5, 0.5 will put something in the exact middle of the screen. The 0.5s in the UDim2 are for the 'scale' - a scale of 1 means the right/bottom side of the screen and a scale of 0 means the left/top. Changing the AnchorPoint to 0.5, 0.5 tells Roblox that the Position you are specifying is meant for the middle of the object you're positioning (0,0 is top-left and 1,1 is top-right).

If you're not using scripts to position a GUI, it's a good idea to use the Scale system so that it will automatically adapt to whatever screen resolution the player happens to have.

0
Could you explain the scale system? I will accept but I'm unsure as to what that is. I'm very new to GUI's. cmgtotalyawesome 1418 — 6y
0
thanks cmgtotalyawesome 1418 — 6y
Ad

Answer this question