Is there a way a command can only be used when clicking in a 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!

Status
Not open for further replies.

nTrok

Member
Dec 8, 2019
1
0
0
I have a skript i'm writing, and I am making it so when you right click an item generator, it will open a gui and you can upgrade the level of it, is there a way that you can run the command that upgrades it only from the gui and players cant do /upgrade1 to get a free generator?

https://pastebin.com/e00pc1iy
 
  1. Code:
    on place of white stained glass:
      if player's tool is white stained glass named "&fGenerator - T1":
        message "&aPlaced a Tier 1 Generator"
        set {_drop} to block above event-block
        add {_drop} to {drops1::*}
     
    on break of white stained glass:
      give player 1 white stained glass named "&fGenerator - T1"
      message "&cBroke a Tier 1 Generator"
      remove block above event-block from {drops1::*}
     
    on rightclick with paper:
      if player's tool is paper named "&a$1":
        execute console command "eco give %player% 1"
        remove paper named "&a$1" from player
     
    on right click:
      if clicked block is white stained glass:
        wait 3 ticks
        open virtual chest with 3 rows named "&fGenerator - T1" to player
        format gui slot 15 of player with barrier named "&cRemove" to run:
          close player's inventory
          remove block above event-block from {drops1::*}
          set block to air
          give player white stained glass named "&fGenerator - T1"     
        format gui slot 12 of player with yellow stained glass named "&3Upgrade" to run:
          set block to air
          if player's balance is more than or equal to 150:
            close player's inventory
            remove block above event-block from {drops1::*}
            remove 150 from player's balance
            give player yellow stained glass named "&fGenerator - T2"
            send "Upgraded Generator!"
          else:
            close player's inventory
            give player white stained glass named "&fGenerator - T1"
            send "&cYou Do Not Have Enough Money For This!"
    
     
    every 5 real seconds:
        drop 1 paper named "&a$1" at {drops1::*}
        loop {gen::*}:
 
Status
Not open for further replies.