GUI Objects


The ExplorerImageIndex 47ScreenGui contains all GUI objects a player can see. They must be placed inside a ExplorerImageIndex 12Player's ExplorerImageIndex 46PlayerGui to be visible.
Gui objects

Gui objects

There is also a GuiMain object but it is deprecated now. They are put into ExplorerImageIndex 46StarterGui or are created by a script.


The ExplorerImageIndex 64BillboardGui is a special GUI object, it is attached to a BasePart so it is always above/under/next to a part. To attach a BillboardGui to a Part instance, set The BillboardGui's Adornee property to the part.


The ExplorerImageIndex 48Frame represents a rectangle on the screen. Most other GUI objects are based on the Frame.


The ExplorerImageIndex 50TextLabel represents a ExplorerImageIndex 48Frame with a label. To create a TextLabel that just displays the text, set it's Size to 0 x 0 pixels or it's BackgroundTransparency to 1.


The ExplorerImageIndex 51TextButton looks like a ExplorerImageIndex 50TextLabel, but retrieves 6 additional events (MouseButton1Click, MouseButton1Down, MouseButton1Up, MouseButton2Click, MouseButton2Down, MouseButton2Up) which are fired when the player clicks on the TextButton.


In addition to the events and properties of ExplorerImageIndex 50TextLabel, the text of a ExplorerImageIndex 51TextBox can be changed by the ExplorerImageIndex 12Player online. To do so, the player has to click on the TextBox, write something and then press enter. The TextBox only supports lower case characters, numbers and some other character like ",", ".", "/" etc.


Is a Frame, that shows an image that is placed over the background of the ImageLabel and streched to it's Size.


The ImageButton is just an ImageLabel with the same events as TextButton.

Like all objects in Roblox, you can create an instance of those GUI objects with


The coordinates of the Roblox GUI have 4 values: X.Scale, X.Offset, Y.Scale and Y.Offset. To create a new coordinate value use, this function takes 4 arguments and returns a userdata.

something.Position =, 10, 0, 10)
The point,0,0,0) is the upper left corner of your screen (0|0), the highest x coordinate is at the right side of your screen and the highest y coordinate is at the bottom. Something would be at 10|10.

Calculating the absolute position or size.

Even if there is are the properties AbsolutePosition and AbsoluteSize which contain those values, you should know how to

calculate them, so you can understand Roblox' system for sizes and positions better.

Let's start with two frames. The first one will be in a ScreenGui object, the second will be inside the first. Then we make the second one red it should be the same colour.

Example 1

local frame1 ="Frame")
local frame2 ="Frame")
frame1.Parent = script.Parent
frame2.Parent = frame1

That shouldn't be too hard. Now we change the size of frame1.

frame1.Size =, 200, 0, 100)

frame1 is now 200 x 100 pixels big. Now frame2:

frame2.Size =, 0, 0.5, 50)
frame2.BackgroundColor3 =, 0, 0) -- more about colors later

frame2 will cover the left half of frame1, but why?

The second and the third arguments of are the X and the Y-scale. A X-scale of 0.5 is the 1/2 of the Parent's X-size.

absolute_pos_x = me.Position.X.Offset + (me.Position.X.Scale * me.Parent.AbsoluteSize.X) + me.Parent.AbsolutePosition.X
absolute_pos_y = me.Position.Y.Offset + (me.Position.Y.Scale * me.Parent.AbsoluteSize.Y) + me.Parent.AbsolutePosition.Y

absolute_size_x = me.Size.X.Offset + (me.Size.X.Scale * me.Parent.AbsoluteSize.X)
absolute_size_y = me.Size.Y.Offset + (me.Size.Y.Scale * me.Parent.AbsoluteSize.Y)

The AbsoluteSize of a ScreenGui is equal to the size of your window or rather the part used for the 3D world, it's AbsolutePosition is 0|0.

Now let's check it.

absolute_size_x = 0 + (0.5 * 200) + 0 -- the position was not set, it is 0|0 by default.
absolute_size_y = 50 + (0.5 * 100) + 0

You should get this output:

100 , 100

The size of frame1 was 200,100 so frame2 should fit in one helf of it.


Instead of RGBA values, GUIs use RGB values and a special property called BackgroundTransparency (or for text TextTransparency). The properties holding the RGB (in ROBLOX Color3 values) are BackgroundColor3, BorderColor3 and TextColor3. Those name should be self-explanatory. If you want to use BrickColor values use BackgroundColor, BorderColor and TextColor instead. BackgroundTransparency set the transparency for the background and the border, TextTransparency set the transparency for the text. 1 is completely transparent, 0 is non-transparent, 0.5 is 50% transparent etc.

To create a color value use or

local my_color =, g, b)
local my_brick_color = takes 3 numbers from 0 to 1.

violet =, 0, 1)
orange =, 150/255, 0) takes the name or the number of the color you want, "Bright blue" for example.


To test one of those examples, create a ScreenGui, put it into StarterGui then create a Script with the example code you want ant put it inside.

Disappearing red Frame

frame ="Frame")
Disappearing red Frame


frame.BackgroundColor ="Bright red")
frame.Size =, 100, 0, 100)
frame.Position =, -50, 0.5, -50)
frame.Parent = script.Parent
while true do
	for i=1,10 do
		frame.BackgroundTransparency = i/10
	for i=0.9,0,-0.1 do
		frame.BackgroundTransparency = i


button ="TextButton")


button.Size =, 100, 0, 25)
button.Text = "Click me!"
button.Parent = script.Parent

button2 ="TextButton")
button2.Size =, 50, 0, 50)
button2.Position =, -25, 0.5, -25)
button2.Text = "Close"
button2.Visible = false
button2.Parent = script.Parent

function button_Click()
	button2.Visible = true
function button2_Click()
	button2.Visible = false

-- click on both buttons!

Moving square

square ="Frame")
Moving Square

Example 4

square.Parent = script.Parent
square.Size =, 20, 0, 20)
while true do
	for i=0,50 do
		square.Position =, i * 5, 0, i * 5)
	for i=50,0,-1 do
		square.Position =, i * 5, 0, i * 5)


- ROBLOX Community

- ROBLOX Studio Object Browser

- experience of the author of this article