Solved Crates skript not working

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

RedDiamond

Member
Nov 30, 2020
21
0
1
23
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:
on right click:
  if event-block is a lime stained glass:
    if player is holding a tripwire hook named "&a{@ukey}" with lore "&8Use this to open &aUncommon Crate":
      remove 1 tripwire hook named "&a{@ukey}" with lore "&8Use this to open &aUncommon Crate" from player's inventory
      cancel event
      chance of 50%:
        give player 8 golden apple
        send "{@p} &bYou just got &38 Golden Apples &bfrom the crate"
      chance of 13%:
        give player 1 of blaze rod of mending named "&cFire Wand" with lore "&cUse &c&lRIGHT CLICK &r&cto shoot a fireball"
        send "{@p} &bYou just got &31 Fire Wand &bfrom the crate"
      chance of 16%:
        give player 1 of sunflower of mending named "&6Token" with lore "&8You can use this to buy &aCustom Items"
        send "{@p} &bYou just got &31 Token &bfrom the crate"
      chance of 5%:
        give player 1 enchanted golden apple
        send "{@p} &bYou just got &31 Enchanted Golden Apple &bfrom the crate"
      chance of 14%:
        give player 2 of tripwire hook named "&a{@ukey}" with lore "&8Use this to open &aUncommon Crate"
        send "{@p} &bYou just got &31 Uncommon Key &bfrom the crate"   
      chance of 1%:
        give player 1 of tripwire hook named "&9{@ekey}" with lore "&8Use this to open &9Epic Crate"
        send "{@p} &bYou just got &31 Epic Key &bfrom the crate"   
    else:
      push the player backwards with speed 2
      send "{@p} &bUse {@ukey} to open this crate"
 
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
 
Status
Not open for further replies.