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
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"