Fandom

ROBLOX Wikia

Nickguletskii200's GUI Introduction

12,564pages on
this wiki
Add New Page
Talk6 Share

What are GUIs?

GUI is an abbreviation of Graphical User Interface. The GUIs make the computer easy to understand - have you ever seen how DOS looks?

UDim2

UDim2 is the positioning system for 2D GUIs. It consists of two categories: X and Y. X and Y each have subcategories - scale , relative to the size of the screen, and offset, in fixed units: pixels.

UDim2 UDim2Scale

UDim2 is formatted like this: scalex ,offsetx ,scaley ,offsety .

UDim2Offset You can use scale and offset together:

Position 0.5,-55,0.5,-55 would make the object appear 55 pixels to the left and up of the centre of the parent component (rendering area)

GUI basics

Player's GUI

Player's GUI is always in PlayerGui object in Player object.

Starter GUI

StarterGui is a service found in the DataModel . It holds GUI items that will get copied over to the player's GUI every time the player respawns.

Public GUI

Only a few objects can be used in workspace, like SelectionBox .


Your first GUI

  1. Insert a "ScreenGui " object into StarterGui.
  2. Insert a "TextButton " object into the ScreenGui.
  3. Set its position as UDim2: 0.4,0,0.4,0
  4. Set its size as UDim2: 0.2,0,0.2,0
  5. Create a script inside the TextButton
  6. Now, you can make it do something
  7. Set script source as
script.Parent.MouseButton1Click:connect(function() print("Hello World!")end) 
  1. Now play in Solo! In the Output, you should see "Hello World!" affter you lick the button!

Understanding the structure

Like in Windows, each window has a process (some processes can have a few windows). ScreenGui is like a process - it holds the components.

Each 2D component can act as a frame. E.g. you can add a TextButton into an ImageLabel.

As you add components inside the other components, UDim2 scale will become relative to it's parent.

Main 2D components

  • Frame - a basic container that can be coloured in, as most of the other 2D objects.
  • TextLabel - a frame with text in it.
  • ImageLabel - a frame with an image in it (decal).
  • TextBox - a TextLabel with an ability of editing it's text.
  • TextButton - a TextLabel that can detect the mouse events like MouseButton1Clicked.
  • ImageButton - like a TextButton, but with an image in it.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.