Skip to content

(Removed) UI

Removed

The UI static class was removed in Version 1.2.0, and is currently noted for documentation purposes.

Static Class

This object is a static class. It can be accessed by using its name as a keyword like this: UI.

Additionally, it cannot be created in the creator menu or with Instance.New().

UI was a static class used for creating User Interface elements through LocalScripts. While it is possible to create UI elements in normal scripts, it will only work in local playtesting and not on server.

Methods

CreateButton → UIButton

Creates a GUI Button

Example

local button = UI:CreateButton()
button.Size = Vector2.New(200,100)
button:ApplyAnchorPreset(AnchorPreset.Center)

CreateEmpty → UIField

Creates an empty UIField

Example

local empty = UI:CreateEmpty()

CreateImage → UIImage

Creates an UI image.

Example

local image = UI:CreateImage()
image.ImageID = 12384
image.ApplyAnchorPreset(AnchorPreset.Center)
image.Size = Vector2.New(200,200)

CreateLabel → UILabel

Parameters: text [ string ]

Creates a text label.

Example

local text = UI:CreateLabel()
text.ApplyAnchorPreset(AnchorPreset.Center)
text.Size = Vector2.New(200, 32)
text.Text = "Hello, world!"

CreateHorizontalLayout → UIHorizontalLayout

Creates a horizontal UI layout.

Example

local layout = UI:CreateHorizontalLayout()

CreateVerticalLayout → UIVerticalLayout

Creates a horizontal UI layout.

Example

local layout = UI:CreateVerticalLayout()

Properties

ScreenHeight : int

Get current user's screen height

Example

local Background = UI:CreateImage()
Background.ImageID = 12384
Background.ApplyAnchorPreset(AnchorPreset.Center)
Background.Size = Vector2.New(UI.ScreenWidth,UI.ScreenHeight)

ScreenWidth : int

Get current user's screen width

Example

local Background = UI:CreateImage()
Background.ImageID = 12384
Background.ApplyAnchorPreset(AnchorPreset.Center)
Background.Size = Vector2.New(UI.ScreenWidth,UI.ScreenHeight)