I need help clicking on a slot in my inventory and using a command to open the 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 community!

    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!

xsamit

Member
Feb 4, 2024
2
0
1
I want it pressed in the crafting field. which now works
1707085579643.png


But when I press these It also uses open gui command. I don't know how to fix the problem please help me.
1707085603786.png

1707085706005.png


And in creative mode inventory, I can't move items anywhere.
1707085994205.png


Code:
on inventory click:
    if clicked slot = 1 :
        player command "profile %player%"
        cancel event
    else:
        cancel event
on inventory click:
    if clicked slot = 2:
        command "dm open basics_menu %player%"
        cancel event
    else:
        cancel event
on inventory click:
    if clicked slot = 3:
        command "dm open basics_menu %player%"
        cancel event
    else:
        cancel event
on inventory click:
    if clicked slot = 4:
        command "dm open basics_menu %player%"
        cancel event
    else:
        cancel event
on inventory click:
    if clicked slot = 0:
        open crafting table to player
        cancel event
    else:
        cancel event
 
I can already see many things wrong with this code,

Instead of
Code:
clicked slot
use
Code:
event-slot
and replace the
Code:
=
(same lines) with
Code:
is
and also when you are calling a specific slot, you are calling the wrong ones. Look up an image for "minecraft inventory slots". And OMG you don't need to call
Code:
on inventory click
every time. Just use one inventory click then put all the "if" statements in that 1 inventory click then the "else" at the end.
 
I can already see many things wrong with this code,

Instead of
Code:
clicked slot
use
Code:
event-slot
and replace the
Code:
=
(same lines) with
Code:
is
and also when you are calling a specific slot, you are calling the wrong ones. Look up an image for "minecraft inventory slots". And OMG you don't need to call
Code:
on inventory click
every time. Just use one inventory click then put all the "if" statements in that 1 inventory click then the "else" at the end.

I still don't quite understand. But am I doing this right? I only want to click on the first crafting slot for the command to work. But now when I click on the second slot in my inventory and the first crafting table slot the command still works.

Code:
on inventory click:
    if event-slot is 1 :
        player command "profile %player%"

1707136254242.png


1707136411437.png
1707136329638.png
 
I still don't quite understand. But am I doing this right? I only want to click on the first crafting slot for the command to work. But now when I click on the second slot in my inventory and the first crafting table slot the command still works.

Code:
on inventory click:
    if event-slot is 1 :
        player command "profile %player%"

View attachment 8243

View attachment 8246View attachment 8244
maybe try lokking up skript inventory slots