What is offset?

Hello developers, in some code mainly in UI I see people use offset I have no idea what it means. I only know its the size of something. Any help thanks

Have you searched on the forum first?

"The Offset UDim2 value will stay with the same amount of pixels, no matter what screen they’re being viewed on.
Scale is based on percentages, a “0.5” Size value will take up half of the screen (0.5 = 50%).

To ensure that your UI scales properly across every device, make sure that the offset property is set to 0. However, if you would like to get technical, a mix of Scale and Offset would work just as well.
As an end product, your UI should scale properly -"

I searched this topic What offset means and how i use it and it still doesn’t make since

When referring to UI size, offset is the measurement in pixels, while scale is proportionate to the screen(or parent of the UI if the UI happens to be in a frame or other UI element): 0 being none of the screen and 1 being the entirety.

When setting up side and position of UI, although set in 2 dimensions, you must include all 4 parameters:
{X Value in Scale, X Value in Offset(Pixels)},{Y Value in Scale, Y Value in Offset(Pixels)}

When you design your UI, remember that your resolution may be different from other users, so 100 pixels to you might take up much less or much more of your screen than someone with a different size device.

Offset is the number of pixels to deviate away from the original position. They are additive, meaning that they will add on to the position. In UDim2, they are the 2nd and 4th parameters in the tuple constructor.

local a = UDim2.new(0.25, 10, 0.75, 5) --10 and 5 are the offsets

In the example above, the UDim2 position is offset by 10 pixels to the right and 5 pixels down (pixels are counted starting from the top left of the screen)
Note that offset can push GUIs out of the screen if it’s pushing it out of the viewport.

So if the offset is 0 then the size is 0? Meaning it won’t show on the screen

If your scale is 0 as well, yes.

So offset is how far the gui is away from the origin?

Also is offset position or size

Offset can be both depending on how you use it.

So {0.267, 0},{0.174, 0} the 0’s are the offset of the frame?

1 Like

This article explains everything (scroll down to the Offset section)

Also to add on its 0 studs away from the origin in offset position? I just need to change the other stuff?

Okay I will read it and come back

Is offset measured in pixels? Like if I change the gui offset to 10 it will move 10 pixels?

I already said it earlier, offset is in pixels. What you said is correct

What is the point of offset if you can just change the position sorry if it is a dumb question

UDim2 uses both scale and offset. Scale depends on the screen resolution (the display size), while offset does not.

So scale is just changing the size?

Please go back to the article I referred to earlier