Roblox UDim2 Calculator: Scale, Offset & AnchorPoint

See how scale, offset, and an anchor combine. Enter a parent size, change the frame’s settings, and inspect the resulting rectangle before trying the values in Roblox Studio.

Start from a layout

Reference parent
Size
Position
AnchorPoint

Your frame in the parent

Gray is the parent. Blue is the frame. Orange marks its anchor. The diagram is fitted to this panel; dimensions below use your reference pixels.

Calculated size
368 × 240 px
Top-left in parent
216, 180 px

The frame fits inside the reference parent.

-- Settings for an existing GuiObject named frame in your script
-- Reference parent for this calculation: 800 x 600 pixels
local size = UDim2.new(0.5, -32, 0.4, 0)
local position = UDim2.new(0.5, 0, 0.5, 0)
local anchorPoint = Vector2.new(0.5, 0.5)

-- Apply after selecting your own compatible GuiObject:
-- frame.Size = size
-- frame.Position = position
-- frame.AnchorPoint = anchorPoint

Use the actual parent as your reference

The reference width and height describe the immediate container in this calculation. If a Frame is nested inside another Frame, enter that parent’s size, rather than automatically using the whole device screen. The preview is a mathematical diagram fitted to the available space, not an engine rendering or a screenshot at one-to-one pixels.

Add scale and offset

Roblox’s position and size guide describes scale as a fraction of the parent dimension and offset as an additive pixel amount. For each axis, this calculator uses parent dimension × scale + offset. A width of 0.5 scale and -32 offset inside an 800-pixel parent therefore gives 368 pixels.

Try changing only the parent width from 800 to 400. The same width expression becomes 168 pixels. Then set width scale to 0 and width offset to 200: the width remains 200 for either parent. Neither form is universally correct; choose the relationship that matches your design.

Account for AnchorPoint when locating the top-left

Position locates the frame’s anchor within its parent. The rectangle’s top-left is that position minus the frame size multiplied by AnchorPoint. With a 368-pixel width and a centered anchor, half the width lies to either side of the anchor position. Change Anchor X to 0 while keeping position fixed to see the rectangle move to the right of that same point.

The UDim2 reference lists the four-argument constructor used in the exported code. AnchorPoint is a separate Vector2 property; changing a UDim2 alone does not change the anchor.

Compare three starting layouts

Centered panel combines a proportional size with a centered position and anchor. Top-right HUD uses a fixed size with a right-edge anchor and an inset. Inset frame subtracts 32 pixels from both parent dimensions and starts 16 pixels from the top-left. These are editable examples, not official device-safe templates. Presets keep your reference parent dimensions; Reset all restores every field.

Know what the calculation leaves out

This tool calculates one unrotated rectangle without UI layouts, constraints, AutomaticSize, UIScale, padding effects, scrolling, screen insets, or text measurement. It reports when the rectangle exceeds its parent and clips that part of the diagram. It does not silently clamp the exported values or claim to match the final rendered AbsoluteSize of a constrained GUI.

The editor accepts whole parent dimensions from 1 to 8192 pixels, integer offsets from -8192 to 8192, scale from -2 to 2, and anchors from 0 to 1. Resulting sizes must be non-negative. These are editor limits for this exercise. Invalid inputs disable export until corrected. All settings reset on reload.

Take the settings into a real interface

The download contains Size, Position, and AnchorPoint variables with commented assignments for your own GuiObject. It does not create a complete menu. Follow the Roblox GUI tutorial for a complete local practice panel, and use the Color3 picker for its colors.

Test the actual interface in Studio at several viewport sizes. Check readable text, long labels, touch controls, reserved screen areas, and behavior after respawn. A rectangle that fits the reference parent is only the geometry check; it does not establish that the whole interaction works on every device.