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.

Solved Crates skript not working

Discussion in 'Skript' started by RedDiamond, May 1, 2021.

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

    RedDiamond Member

    Joined:
    Nov 30, 2020
    Messages:
    16
    Likes Received:
    0
    So i've made a simple crates skript but the problems is sometimes when i right click with the key it didnt give me any rewards and sometimes it gave me 2 rewards on 1 key, can anyone help me to see what's the problem in this code, it'll help me so much. Thx :emoji_slight_smile:

    Code (Text):
    1. on right click:
    2.   if event-block is a lime stained glass:
    3.     if player is holding a tripwire hook named "&a{@ukey}" with lore "&8Use this to open &aUncommon Crate":
    4.       remove 1 tripwire hook named "&a{@ukey}" with lore "&8Use this to open &aUncommon Crate" from player's inventory
    5.       cancel event
    6.       chance of 50%:
    7.         give player 8 golden apple
    8.         send "{@p} &bYou just got &38 Golden Apples &bfrom the crate"
    9.       chance of 13%:
    10.         give player 1 of blaze rod of mending named "&cFire Wand" with lore "&cUse &c&lRIGHT CLICK &r&cto shoot a fireball"
    11.         send "{@p} &bYou just got &31 Fire Wand &bfrom the crate"
    12.       chance of 16%:
    13.         give player 1 of sunflower of mending named "&6Token" with lore "&8You can use this to buy &aCustom Items"
    14.         send "{@p} &bYou just got &31 Token &bfrom the crate"
    15.       chance of 5%:
    16.         give player 1 enchanted golden apple
    17.         send "{@p} &bYou just got &31 Enchanted Golden Apple &bfrom the crate"
    18.       chance of 14%:
    19.         give player 2 of tripwire hook named "&a{@ukey}" with lore "&8Use this to open &aUncommon Crate"
    20.         send "{@p} &bYou just got &31 Uncommon Key &bfrom the crate"  
    21.       chance of 1%:
    22.         give player 1 of tripwire hook named "&9{@ekey}" with lore "&8Use this to open &9Epic Crate"
    23.         send "{@p} &bYou just got &31 Epic Key &bfrom the crate"  
    24.     else:
    25.       push the player backwards with speed 2
    26.       send "{@p} &bUse {@ukey} to open this crate"
     
  2. Mattia

    Mattia Member

    Joined:
    Apr 4, 2021
    Messages:
    30
    Likes Received:
    1
    So for what you want to do the chances aren't good, try adding all the items to a list and giving the player a random element from the list
     
  3. RedDiamond

    RedDiamond Member

    Joined:
    Nov 30, 2020
    Messages:
    16
    Likes Received:
    0
    okay thx for the help
     
Thread Status:
Not open for further replies.

Share This Page

Loading...