Skip to content

Adding GUI Functionality

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

Getting Started

Now that we have created a GUI, the next step is to give it some functionality. The make gui slot effect/section can be used to accomplish that:

(make|format) [the] next gui [slot] (with|to) [[re]mov[e]able|stealable] %itemtype%
(make|format) gui [slot[s]] %integers/texts% (with|to) [[re]mov[e]able|stealable] %itemtype%

Tip

Curious about why GUI slots can be text?
Click here to read about custom layouts!

Tip

What does it mean for an item to be removable?
Click here to read about a GUI's lock status!

Adding an Item

When used as an effect, make gui slot can be used to add items to the GUI. By default, items cannot be removed from a GUI.

For example, we can taunt the player with a diamond:

make the next gui slot with a diamond named "<blue>Try and steal me!"
image

Adding an Item with Functionality

When used as a section, make gui slot can be used to add items to the GUI that run code when clicked. By adding a colon to turn the line into a section, any code within that section will be run when the item is clicked:

format the next gui slot with a cherry button named "<pink>Press me!":
	give the player a diamond
skript-gui-make-slot.mov

Removing an Item

It's also possible to remove items (and their associated actions) by unformatting a slot. This is done using the unmake gui slot effect:

(un(make|format)|remove) [the] (next|last) gui slot
(un(make|format)|remove) gui [slot[s]] %integers/texts%
(un(make|format)|remove) [all [[of] the]|the] gui [slots]

For example, by nesting this within a make gui slot section, we can add an item that removes all items in the GUI when clicked:

format the next gui slot with a potion of invisibility named "<purple>Magician's Potion":
	unformat all of the gui slots
skript-gui-unmake-slot.mov

Tip

Wondering what else you can listen for in a GUI?
Click here to view the other GUI events that can be used!

Full Code

Now, our full code looks something like this:

create a gui with a virtual chest inventory named "<rainbow>My Awesome GUI" with 3 rows:
	make the next gui slot with a diamond named "<blue>Try and steal me!"
	format the next gui slot with a cherry button named "<pink>Press me!":
		give the player a diamond
	format the next gui slot with a potion of invisibility named "<purple>Magician's Potion":
		unformat all gui slots
	open the last created gui for the player

Clone this wiki locally