Hi so I made this skript to do so that when I click on a chest with a crate key some stuff will happen but for somereason all it does is launch the firework, how can I fix that?
Also I figured out that the code stops working after "launch "BURST" firework at location of event-block with timed -1"
Code:
on right-click:
if location of target block is location( -16.5, 67.5, -2.5, world "earth"):
if player's tool is glowing tripwire hook named "&7Rankup Crate Key" with lore "&6Right-Click on a crate to use":
cancel event
launch "BURST" firework at location of event-block with timed -1
remove 1 of glowing tripwire hook named "&7Rankup Crate Key" with lore "&6Right-Click on a crate to use" from player's inventory
set {reward.%player%} to random integer between 1 and 4
if {reward.%player%} is "1":
send "&6&lCrates&8: &7Congratulations &e%player%&7! &7You have won &9100'000$"
add 100000 to player's balance
stop
else if {reward.%player%} is "2":
send "&6&lCrates&8: &7Congratulations &e%player%&7! You have won &95'000 coins"
add 5000 to {coins::%player's uuid%}
stop
else if {reward.%player%} is "3":
send "&6&lCrates&8: &7Congratulations &e%player%&7! &7You have won &91'000'000$"
add 1000000 to player's balance
stop
else if {reward.%player%} is "4":
send "&6&lCrates&8: &7Congratulations &e%player%&7! You have won &910'000 coins"
add 10000 to {coins::%player's uuid%}
stop