on inventory click event in GUI

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

loadka95

Active Member
Feb 24, 2017
78
6
8
26
I have a parkour skript, and I try to create a GUI menu for all the arenas has been created.
But when i try to click on an item in the GUI It's doesn't recognize the click event and nothing happens... even the message doesn't show up, But when i click on an empty slot it's works the (message "%loop-value%") shows up...

Code:
code_language.skript:
command /gui:
    trigger:
        if size of {parkourarena::*} = 0:
            send "{@park}Empty."
        else:
            open chest with 6 rows named "&8Arenas" to player
            clear {parkarena.amount}
            loop {parkourarena::*}:
                add 1 to {parkarena.amount}
                format slot {parkarena.amount}-1 of player with stone named "%loop-value%" with lore "&e&oClick to join." to be unstealable
on inventory click:
    loop {parkourarena::*}:
        message "%loop-value%"
        if name of clicked item is equal to loop-value:
            execute player command "/parkour join loop-value"
 
You are using two different things to make a gui. The format slot from SkQuery is old and it lacks alot.
You can use TuSKe to make your guis, since it has a remade of SkQuery's format slot, fixing all issues:
code_language.skript:
open chest with 6 rows named "&8Arenas" to player
set {_slot} to 0
loop {parourarena::*}:
    set {_item} to stone named "%loop-value%" with lore "&e&oClick to join" #Using a variable to be easier to see
    make gui slot {_slot} of player with {_item}  to run player command "/parkour join %loop-value%"
    add 1 to {_slot}
 
Status
Not open for further replies.