1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

GUI right click event

Discussion in 'Skript' started by Steven F, Jun 1, 2017.

Thread Status:
Not open for further replies.
  1. S

    Steven F Member

    Joined:
    Apr 9, 2017
    Messages:
    10
    Likes Received:
    0
    Hi,

    Is there any way to detect a right click in a GUI and run an alternate function/command if the user right clicked?

    For example a shop where left click is buy and right click is sell.

    Thanks!
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,736
    Likes Received:
    120
    on right click with chest:
    open chest with (number) rows named " " to player
    wait 1 tick
    format slot 3 of player with (id/block) named " " to close then run/to run [execute player command "command"]
    format slot 4 of player with (id/block) named " " to close then run/to run [execute player command "command"]
    format slot 5 of player with (id/block) named " " to close then run/to run [execute player command "command"]
    format slot 6 of player with (id/block) named " " to close then run/to run [execute player command "command"]
     
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,736
    Likes Received:
    120
    Hmm I'm looking for actually right clicking an item within the GUI and calling a function :emoji_stuck_out_tongue:
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,736
    Likes Received:
    120
    Code (Skript):
    1. command /open:
    2.     trigger:
    3.         open chest with 6 rows named "&4&lExample" to player
    4.         set slot 22 of player's current inventory to a nametag named "Name" with lore "lore"
    5.  
    6. on inventory click:
    7.     if inventory name of player's current inventory is "&4&lExample":
    8.         cancel event
    9.         if clicked slot is 22:
    10.             if clicked type is right mouse button:
    11.                 functionRight(player)
    12.             else if clicked type is left mouse button:
    13.                 functionLeft(player)
    SkQuery and Bensku's Skript
     
    • Informative Informative x 2
    • Winner Winner x 1
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,736
    Likes Received:
    120
    Very helpful, thanks!
     
Thread Status:
Not open for further replies.
Loading...