Skip to content

ScriptHubGui (v3)

c edited this page Mar 22, 2023 · 3 revisions

ScriptGui

ScriptGui named "Example"

The main container of your Gui, all Categories and Elements go under this

In Order to show the Gui, a ScriptGui will automatically create a new Category that matches the name of the ScriptGui and cannot be changed

Properties

type name description
{Category} Categories List of Categories in that are displayed under this ScriptGui
number LayoutOrder The order the ScriptGui is displayed in, if its parent's SortOrder is LayoutOrder
Category MainCategory A Category that matches the name of the ScriptGui and cannot be changed
string Name The text displayed on the left side of the Element
ScriptGui, Category, ListElement Parent The ScriptGui, Category, or ListElement the Element will be displayed under
SortOrder SortOrder Determines how the Category will sort its Categories

Methods

return type name description
void Destroy Removes the ScriptGui and calls Destroy on all Categories under it

Category

Category under a ScriptGui named "Example"

The container of your Elements

Properties

type name description
{Element} Elements List of Elements that are displayed under the Category
number LayoutOrder The order the Category is displayed in, if its parent ScriptGui's SortOrder is LayoutOrder
string Name The text displayed on the left side of the Element
ScriptGui Parent The ScriptGui the Category will be displayed under
SortOrder SortOrder Determines how the Category will sort its Elements

Methods

return type name description
void Destroy Removes the Category and calls Destroy on all Elements under it

Element

The base Element class. Elements can be parented under ScriptGuis (will be parented to its MainCategory), Categories, and ListElements as they all have an ElementContainer

Properties

type name description
number LayoutOrder The order the Element is displayed in, if its parent's SortOrder is LayoutOrder
ScriptGui, Category, ListElement Parent The ScriptGui, Category, or ListElement the Element will be displayed under
string Name The text displayed on the left side of the Element

Methods

return type name description
void Destroy Removes the Element

Types of Elements

BooleanElement

Two BooleanElements, one set to true and the other set to false

An Element that the user can click on to switch between true and false.

Properties

type name description
boolean Value current value of the BooleanElement

Methods

return value name description
void Destroy Removes the BooleanElement from its parent

Events

fire value type name description
boolean ValueChanged fires when the Value changes, passing the new value

StringElement

StringElement with PlaceholderText

An element that lets the user type in the TextBox

Properties

type name description
string Value current value of the StringElement
string PlaceholderText Text to display when the TextBox is empty

Methods

return value name description
void Destroy Removes the StringElement from its parent

Events

fire value type name description
boolean ValueChanged fires when the FocusLost fires on the TextBox, changing the value

NumberElement

NumberElement with PlaceholderText of "0"

Similarly to StringElement, this lets the user type in a TextBox, but only allows for numbers to be inputed

Properties

type name description
number Value current value of the NumberElement
string PlaceholderText Text to display when the TextBox is empty

Methods

return value name description
void Destroy Removes the NumberElement from its parent

Events

fire value type name description
number ValueChanged fires when the FocusLost fires on the TextBox, checking if the value is a number and changing it

KeybindElement

KeybindElement with a value of Enum.KeyCode.E

When clicked, the user is prompted to press any key on their keyboard. Once the user does, the interaction ends and displays the key the user set

Properties

type name description
KeyCode Value current value of the KeybindElement

Methods

return value name description
void Destroy Removes the KeybindElement from its parent

Events

fire value type name description
void SelectionEnded fires when the user clicks the button, beginning key selection
void SelectionStarted fires when the user presses a key on their keyboard after clicking the button to select a key
KeyCode ValueChanged fires when the interaction finishes, passing the new value

ButtonElement

two ButtonElements, one with text and the other without

It's just a button. It can display text if specified.

Properties

type name description
string Text Text to be displayed on the ButtonElement

Methods

return value name description
void Destroy Removes the ButtonElement from its parent

Events

fire value type name description
void OnClick fires when the user clicks the button

ListElement

Closed ListElement Opened ListElement with no Elements Opned ListElement with Elements, including another ListElement

A special Element does not hold a Value but instead contains other Elements. A ListElement can also contain another ListElement

Properties

type name description
{Element} Elements Elements that are displayed under the ListElement
SortOrder SortOrder Determines how the ListElement will sort its Elements

Methods

return value name description
void Destroy Removes the ListElement from its parent and calls Destroy on all Elements under it

Events

fire value type name description