Collapse Sidebar




AbsoluteRotation is a read-only property that describes the actual screen rotation of a UI element, in degrees. This property, GuiBase2d/AbsoluteSize and GuiBase2d/AbsolutePosition are a group of properties that all describe the final rendered orientation of a UI element. It composes (sums) each of the UI element’s ancestors’ GuiObject/Rotation into one value. It does not perform bounds checking, so its value may not be in the range 0 ≤ x < 360 degrees.

For example, if FrameA has a rotation of 40 degrees, and FrameB within it has a GuiObject/Rotation of 50 degrees, then FrameB’s AbsoluteRotation would be 90 degrees.

Code Samples

Copycat Frame

This code sample shows how a UI element’s size, position and rotation can be copied without parenting a “copycat” to the original. It uses the Absolute-family of properties to orient a “copycat” Frame that covers on the screen space that the original does.

-- Place within a Frame, TextLabel, etc.
local guiObject = script.Parent

-- For this object to be rendered, it must be a descendant of a ScreenGui
local screenGui = guiObject:FindFirstAncestorOfClass("ScreenGui")

-- Create a copy
local copycat = Instance.new("Frame")
copycat.BackgroundTransparency = 0.5
copycat.BackgroundColor3 = Color3.new(.5, .5, 1) -- Light blue
copycat.BorderColor3 = Color3.new(1, 1, 1) -- White

-- Orient the copy just as the original; do so "absolutely"
copycat.AnchorPoint = Vector2.new(0, 0) 
copycat.Position = UDim2.new(0, guiObject.AbsolutePosition.X, 0, guiObject.AbsolutePosition.Y)
copycat.Size = UDim2.new(0, guiObject.AbsoluteSize.X, 0, guiObject.AbsoluteSize.Y)
copycat.Rotation = guiObject.AbsoluteRotation

-- Insert into ancestor ScreenGui
copycat.Parent = screenGui