So there are 2 factors (Whatever you call them), that can be used to change the size of the GUI, Offset and Scale.
My question is when is the best time to yous each?
Scaling
a GUI keeps it in proportion
to it's environment. Think of it like a tree, as a tree grows bigger, it's branches grow thicker and stronger in proportion to the size of the tree.
In the case of a GUI, it's environment would be your screen (or another GUI it's inside of). So as the parent of your GUI's size or position changes, the GUI that's scaled inside of it will continue to stay in proportion to it's parent.
Here's an example I whipped up, where the grey GUI is the scaled
one, and the white GUI is it's parent that varies in size accordingly to the mouse's position: https://gyazo.com/414045c7f4221a4e3e4790d5cfff0a94
The exact size of the grey GUI in the above example is UDim2.new(0.5,0,0.5,0)
. Much like how Transparency
and Reflectance
works, scaling ranges from 0 - 1
. 0 being 0%
, and 1 being 100%
. For example, something with the size of UDim2.new(1,0,1,0)
, will take up the width and height of the entire screen exactly by 100%.
Also notice that only the first number of each 2 numbers in UDim2.new
function was given a value. This is because those specific arguments are the ones that get scaled. Here's a more detailed break down of how that works: http://prntscr.com/bp2r2j
Offset
represents the absolute value
of a GUI's size or position. If you have a GUI with a size offset of 50 X, that means that GUI will always be 50 pixels long no matter what - the environment has no effect on it. Here's an example of the same program from above, but with offset given for the grey GUI instead of scale: https://gyazo.com/dfa35a25430180d1cdf28ca9544119a6
The exact size of the grey GUI from above is UDim2.new(0,50,0,50)
. Notice only every second number is assigned a value, they're obviously the offset values.
To actually answer your question, it really entirely depends on what you want to do. Here's a list I'd personally go by that just gives some examples of when to scale something vs when to offset it:
Scale
Making a fade in/out GUI that covers the entire screen
Making a chat system frame
Making a health bar
Making a GUI-based game with a screen window
Offset
Working with GUIs that the player can edit
Making a GUI that's size / position depends on mouse input
Making GUI particles effects
Changing the size / position of message logs
But those are just some random examples, you're not limited to them nor obligated to use them for these situations. Hope this helped, just let me know if you have any questions!