Tutorial by: Radicc


This is just a quick gui tutorial for starters!

There is many creative ways to make a gui but the one i like is the one i'm going to show you!

We will start with a command like normal

command /gui:
    trigger:

You can also add permission and messages

command /gui:
    permission: gui.use
    permission message: &cYou dont have permission to use this command!
    trigger:

To make the gui i will put it in a variable like this:
set {_gui} to chest with 3 rows named "&2GUI"
The amount of rows can be set to numbers larger than 6 but i will recommend from 1 to 6

so now the code will look like this:

command /gui:
    trigger:
        set {_gui} to chest with 3 rows named "&2GUI"

To set a slot to a item we will do set slot <int> of <inventory> to <item> [named "<text>"] [with lore "<text>"]
Because we made the gui in a variable the variable {_gui} is a inventory

Slots of inventorys starts from 0
So the top left slot will be 0 and the top right slot of a chest or player inventory will be 8

I will set the middle of the inventory (slot 13) to a chest
Now the code will look like this:

command /gui:
    trigger:
        set {_gui} to chest with 3 rows named "&2GUI"
        set slot 13 of {_gui} to chest named "&6Regular chest"

We can make so when you click the chest something will happend
And for that we will make a click event
on inventory click:
We can get alot of events like event-world, event-slot, event-inventory, event-itemstack, event-itemtype, event-player, event-string, event-inventoryaction, event-clicktype
But we will only be using event-inventory, event-item

So we can do this:

on inventory click:
    if name of event-inventory is "&2GUI":
        if event-item is chest named "&6Regular chest":
            cancel event
            summon cow at player
            close player's inventory

First we make the event and then we check the name of the inventory witch is "&2GUI"
Then we check if the item is a chest named "&6Regular chest"
And finally we cancel the event so we cant steal from the gui and run the code we like, here we summon a cow at the player

So the whole code would look like this:

command /gui:
    trigger:
        set {_gui} to chest with 3 rows named "&2GUI"
        set slot 13 of {_gui} to chest named "&6Regular chest" with lore "&cJust a chest%nl%&4Nothing wierd about it!"
        open {_gui} to player

on inventory click:
    if name of event-inventory is "&2GUI":
        if event-item is chest named "&6Regular chest":
            cancel event
            summon cow at player
            close player's inventory

This is my first tutorial so i would like some feedback! Thanks


Did you find Radicc's tutorial helpful?


You must be logged in to comment

  • April 7, 2023, 6:11 p.m. - ShaneBee  

    SkQuery GUIs are the absolute worst.
    They have major issues with being able to steal from them.

    That said I recommend skript-gui or vanilla Skript.
    No one should ever be using SkQuery's poor excuse of GUIs.

    |     
    April 12, 2023, 10:34 a.m. - Radicc  

    I never had a problem with people stealing things from the gui so unless you can give a example of it SkQuery is fine.

    |     
    May 2, 2023, 2:24 p.m. - GStudiosX  

    skquery is ew though

    |