Jump to content

I need a skript


Juskittin_

Recommended Posts

Hey i need help fixing a skript... I tried coding it myself but it hasn't worked what it is supposed to do is whenever I right-click a chest it give me 1 item out of a selection of items but whenever I try, either it doesn't give me anything or it give me two different items. If you could help me fix this that would be great thank you so much. Here is the skript. 

on right-click:
    if event-block is chest:
        chance of 30%:
            execute console command "/give %player% diamond 1"
        chance of 13%:
            execute console command "/give %player% iron_axe 1"
        chance of 20%:
            execute console command "/give %player% iron_boots 1"
        chance of 20%:
            execute console command "/give %player% iron_helmet 1"
        chance of 7%:
            execute console command "/give %player% diamond_chestplate 1"
        chance of 10%:
            execute console command "/give %player% diamond_leggings 1"

Link to comment
Share on other sites

  • 3 weeks later...

I know im a bit late but, I can help! The issue is that you are assigning a chance to all items. Rather, I would suggest using a if statement instead.

on right-click:
    if event-block is chest:
        send "&6You Opened A Chest"
        set {item} to a random integer from 1 to 10
        if {item} = 1:
            execute console command "/give %player% diamond 1"
        if {item} = 2:
            execute console command "/give %player% diamond 1"   
        if {item} = 3:
            execute console command "/give %player% diamond 1"
        if {item} = 4:
            execute console command "/give %player% iron_axe 1"
        if {item} = 5:
            execute console command "/give %player% iron_axe 1"
        if {item} = 6:
            execute console command "/give %player% iron_axe 1"
        if {item} = 7:
            execute console command "/give %player% iron_boots 1"
        if {item} = 8:
            execute console command "/give %player% iron_helmet 1"
        if {item} = 9:
            execute console command "/give %player% diamond_chestplate 1"
        if {item} = 10:
            execute console command "/give %player% diamond_leggings 1"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...