[SOLVED] loop do not create command associated to an item

  • 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!


Dec 30, 2020
(Translated from google)

My problem is that I cannot make a GUI with a custom command when clicking on it, let me explain:

Each loop makes a custom command to the item to click, well, it does nothing. It does not create any command associated with the item.

The portion of code with the mentioned error:

BUG ON LINE 22 (to run [console command "/insignia show %{_player}% %{_id}%"])
PD: Compiler don't launch any error btw, "all is correct". It loads correctly, but it does nothing.

Pls help :emoji_slight_smile:

EDIT 1: It creates the item correctly, but when you click... it does not run any command.
EDIT 2: The command i want to run exists, i can run it on chat and works. So...??

command /insignia [<text>] [<player>] [<integer=1>]:
    aliases: ins
    permission: admin.mode

        # GUI de insignias
        if arg-1 is "see":
            open chest with 6 row named "&8[ &eInsignias: &f&l%arg-2%&8 ]" to player
            play sound "block.tripwire.click_on" with volume 100 and pitch 1.5 at player for player
            wait 2 ticks

            # Muestra las insignias desbloqueadas del jugador
            set {_player} to "iKOKOi"
            set {_loop} to 54-8
            set {_total} to size of {insignia.iKOKOi::*}
            set {_paginacion} to size of {insignia.iKOKOi::*} / (54-8)
            loop {_loop} times:
                set {_val} to {_loop}-1
                set {_id} to (((arg-3)-1)*(54-8) + {_val})
                if {insignia.%{_player}%::%{_id}%} is set:
                    format slot {_val} of player with {insignia.%{_player}%::%{_id}%} named {insignia.%{_player}%::%{_id}%} to run [console command "/insignia show %{_player}% %{_id}%"]
                    if {_id} is less than {_total}:
                        format slot {_val} of player with barrier named "&7&lInsignia desconocida" with lore "&8???" to be unstealable
                        format slot {_val} of player with air to be unstealable
                remove 1 from {_loop}
I have just added a listener to the skript and use that value as id of the item to call it custom command

on inventory click:
    if name of current inventory is "&8[ &eInsignias: &f&l%{insignia.tmp.%player%::0}%&8 ]":
        set {_slot} to the clicked slot
        set {_id} to ({_slot} + ((54-8)*{insignia.tmp.%player%::1}))
        force player run cmd "/insignia show %{insignia.tmp.%player%::0}% %{_id}%" as op
        force player run cmd "/insignia see %{insignia.tmp.%player%::0}%" as op