Good afternoon,
I am working on a GUI and whenever I resize the screen it moves. Does anyone happen to know a fix where they would lock into position and not move around?
Good afternoon,
I am working on a GUI and whenever I resize the screen it moves. Does anyone happen to know a fix where they would lock into position and not move around?
GUIs can be sized and placed using scale and offset values. Scale is relative to the size of the window / the element it’s inside, and offset is in pixels. If your GUI is moving around when you resize the window, you’re likely using scale to position your GUI elements.
There is no easy rule for when to use scale or offset, but in general, container frames should be placed on the screen using scale (ie. for placing something in the corner or the center of the screen / an element). The container’s placement and the placement of elements within the container should be further refined by using offset.
There is some good information on UDim2’s scale and offset here:
https://www.robloxdev.com/articles/Fundamentals-of-Scripting-with-GUIs
That is not a good idea. UI needs to adapt to screen size and scale, not the other way around. If you want something to for example stay in the center, edge, or corner of a screen, modify the anchor point and set the position accordingly
i.e.
AP of <0,0> and POS of {0,0},{0,0}
AP of <1,0> and POS of {1,0},{0,0}
AP of <0.5,0.5> and POS of {0.5,0},{0.5,0}
and so on
If you only use offsets and not scale values, devices like mobile and tablets will probably not see the GUI depending on where it is on the screen.
It also means that if a player moves the roblox window and halves the size of it, the GUI won’t adjust and they won’t see it.
This might be helpful to gain an understanding of how positions and sizes work in Roblox: