Multiple GUIs with same action

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

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

Jerooski

Member
Apr 19, 2020
16
0
0
25
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:
#---WPICKAXE 1--#
on right click:
    if player's held item is wooden pickaxe of efficiency 1 named "&8Wooden &7Pickaxe &8[&e1&8]":
        open chest inventory with 3 rows named "Pick1" to player
        loop 27 times:
            set slot (loop-number -1) of player' current inventory to black stained glass pane named " "
        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"

on inventory click:
  if clicked slot is 13:
    if player has 50 coal:
      give wooden pickaxe of efficiency 2 named "&8Wooden &7Pickaxe &8[&e2&8]" to player
      remove 50 coal from player
      remove wooden pickaxe of efficiency 1 named "&8Wooden &7Pickaxe &8[&e1&8]" from player
      close player's inventory
    else:
      send "&c&lSorry! You need &e50 Coal"
      close player's inventory
  if event-inventory is not player's inventory:
    cancel event
#---WPICKAXE 2--#
on right click:
    if player's held item is wooden pickaxe of efficiency 2 named "&8Wooden &7Pickaxe &8[&e2&8]":
        open chest inventory with 3 rows named "Pick2" to player
        loop 27 times:
            set slot (loop-number -1) of player' current inventory to black stained glass pane named " "
        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"

on inventory click:
  if clicked slot is 13:
    if player has 150 coal:
      give wooden pickaxe of efficiency 3 named "&8Wooden &7Pickaxe &8[&e3&8]" to player
      remove 150 coal from player
      remove wooden pickaxe of efficiency 2 named "&8Wooden &7Pickaxe &8[&e2&8]" from player
      close player's inventory
    else:
      send "&c&lSorry! You need &e150 Coal"
      close player's inventory
  if event-inventory is not player's inventory:
    cancel event
 
Status
Not open for further replies.