Skip to content

GUI Properties

Patrick Miller edited this page Jul 17, 2026 · 4 revisions

Name

The name of a GUI is the title that was provided during its creation. It can be set, cleared, or reset. You can simply use Skript's 'name' expression to obtain this:

the name of the gui

Note

If you create a GUI using syntax not provided by skript-gui, this value may not be available or accurate.

Size

The size of a GUI is the number of slots it has. It can be set or reset. You can simply use Skript's 'size' expression to obtain this:

the size of the gui

Layout

skript-gui supports defining custom layouts for your GUI that makes defining many slots at once a breeze. The layout of a GUI can be specified during its creation:

create a gui with virtual chest inventory with 3 rows named "Layout GUI" and layout "xxxxxxxxx", "x-------x", and "xxxxxxxxx"

The important part of the syntax here is and layout, with the full pattern being: [(and|with) (layout|shape) %-texts%]. This goes at the end of the create a gui statement.

The layout of a GUI is comprised of texts, where each text represents a row in the inventory, and each character in the text represents a slot. By assigning the same character to multiple slots, those slots will share the same items and behavior when formatted.

So, we can format a specific part of the layout by specifying its identifying character as the slot:

create a gui with virtual chest inventory with 3 rows named "Layout GUI" and layout "xxxxxxxxx", "x-------x", and "xxxxxxxxx":
	make gui slot "x" with gold ingot named "<gold>Treasure"
	open last gui to player

In-game, we can view the result:

image

Layout Expression

The layout of a GUI can also be obtained or change using the gui layout expression:

[gui] (layout|shape)[s] of %guis%
%guis%'[s] [gui] (layout|shape)[s]

For example, we could edit the GUI to invert the shape when the treasure is clicked:

create a gui with virtual chest inventory with 3 rows named "Layout GUI" and layout "xxxxxxxxx", "x-------x", and "xxxxxxxxx":
	make gui slot "x" with gold ingot named "<gold>Treasure":
		if the gui's layout starts with "x":
			set the gui's layout to "---------", "-xxxxxxx-", and "---------"
		else:
			set the gui's layout to "xxxxxxxxx", "x-------x", and "xxxxxxxxx"
open the last created gui for the player
skript-gui-layout.mov

Lock Status (Stealable Items)

A GUI's lock status represents whether the player is prevented from removing items from the GUI.

This can be specified at the GUI level, during GUI creation (the with removable items portion):

create a gui with virtual chest inventory with 3 rows named "Unlocked GUI" with removable items
open the last created gui for the player

It can also be specified for individual items/slots:

create a gui with virtual chest inventory with 3 rows named "Unlocked Items GUI":
	make gui slot 0 with removable air
open the last created gui for the player

In this case, it would only be possible to make changes to the first slot of the inventory. Changes to other slots would be prevented as normal.

Note

When an entire GUI is marked as unlocked, it will still not be possible to modify slots that have an associated action. Those slots must be explicitly marked as unlocked.

It is also possible to check and modify the lock status of a GUI after it has been created, using the is gui locked condition and lock/unlock gui effect:

[gui[s]] %guis% (is|are) (locked|unlocked)
[gui[s]] %guis% (is not|isn't|are not|aren't) (locked|unlocked)
%guis% allow[s] items to be (removed|changed)
%guis% (disallow|prevent)[s] items [from] being (removed|changed)
(lock|unlock) [gui[s]] %guis%
allow items to be (removed|changed) from %guis%
(disallow|prevent) items [from] being (removed|changed) from %guis%

Consider this example that allows toggling whether the GUI is locked:

create a gui with virtual chest inventory with 3 rows named "Unlockable GUI":
	make the next gui slot with a cherry button named "Lock Status: <red>Locked":
		if the gui is locked:
			unlock the gui
			set the name of the gui clicked item to "Lock Status: <green>Unlocked"
		else:
			lock the gui
			set the name of the gui clicked item to "Lock Status: <red>Locked"
open the last created gui for the player
skript-gui-lock-status.mov

Clone this wiki locally