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 out 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.

Multiple GUIs with same action

Discussion in 'Skript' started by Jerooski, Apr 22, 2020.

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

    Jerooski Member

    Joined:
    Apr 19, 2020
    Messages:
    16
    Likes Received:
    0
    USING VANILLA GUIS
    Current Addons: Skellet, SkRayFall, TuSke

    I'm setting up a pickaxe upgrade system. They right click their current pick so it opens the gui and they can purchase the following tier. However, my script is stuck and only works with the first tier. When I open up the second pick tier, when bought, it gives you the first tier prices, cost, and item. How can I have multiple pickaxe tiers, while keeping the script as short as possible and have multiple GUIS. (that also dont happen to have items stealable by players)

    Code (Text):
    1. #---WPICKAXE 1--#
    2. on right click:
    3.     if player's held item is wooden pickaxe of efficiency 1 named "&8Wooden &7Pickaxe &8[&e1&8]":
    4.         open chest inventory with 3 rows named "Pick1" to player
    5.         loop 27 times:
    6.             set slot (loop-number -1) of player' current inventory to black stained glass pane named " "
    7.         set slot 13 of player's current inventory to wooden pickaxe of efficiency 2 named "&8Wooden &7Pickaxe &8[&e2&8]" with lore " " and "&7Costs: &e50 Coal"
    8.  
    9. on inventory click:
    10.   if clicked slot is 13:
    11.     if player has 50 coal:
    12.       give wooden pickaxe of efficiency 2 named "&8Wooden &7Pickaxe &8[&e2&8]" to player
    13.       remove 50 coal from player
    14.       remove wooden pickaxe of efficiency 1 named "&8Wooden &7Pickaxe &8[&e1&8]" from player
    15.       close player's inventory
    16.     else:
    17.       send "&c&lSorry! You need &e50 Coal"
    18.       close player's inventory
    19.   if event-inventory is not player's inventory:
    20.     cancel event
    21. #---WPICKAXE 2--#
    22. on right click:
    23.     if player's held item is wooden pickaxe of efficiency 2 named "&8Wooden &7Pickaxe &8[&e2&8]":
    24.         open chest inventory with 3 rows named "Pick2" to player
    25.         loop 27 times:
    26.             set slot (loop-number -1) of player' current inventory to black stained glass pane named " "
    27.         set slot 13 of player's current inventory to wooden pickaxe of efficiency 3 named "&8Wooden &7Pickaxe &8[&e3&8]" with lore " " and "&7Costs: &e150 Coal"
    28.  
    29. on inventory click:
    30.   if clicked slot is 13:
    31.     if player has 150 coal:
    32.       give wooden pickaxe of efficiency 3 named "&8Wooden &7Pickaxe &8[&e3&8]" to player
    33.       remove 150 coal from player
    34.       remove wooden pickaxe of efficiency 2 named "&8Wooden &7Pickaxe &8[&e2&8]" from player
    35.       close player's inventory
    36.     else:
    37.       send "&c&lSorry! You need &e150 Coal"
    38.       close player's inventory
    39.   if event-inventory is not player's inventory:
    40.     cancel event
     
Thread Status:
Not open for further replies.

Share This Page

Loading...