Jump to content

Help Me With Skript || Not Giving A Diamond?


belac136

Recommended Posts

I have this skript, and i don't know why it doesn't work... Help?

command /shop:
    trigger:
        open virtual chest inventory with size 5 named "&6Crates" to player
        format gui slot 11 of player with {crate::1} named "&fBasic Crate" with lore "&7[&fCosts 1 &bDiamond&7]" to run:
            if player's inventory has 1 diamond:
                remove 1 diamond from player's inventory
                set {_random} to random integer between 1 and 2
        if {_random} is 1:
            send "&7You opened a crate and found: &b1 diamond&7!" to player
            give player 1 diamond
        else:
            if {_random} is 2:
                send "&7You opened a crate and found: &b2 diamonds&7!" to player
                give player 2 diamonds
               
command /itemset [<text>]:
    trigger:
        set {crate::%arg 1%} to player's held item

  • Like 1
Link to comment
Share on other sites

It is your spacing. You have 'if {_random} is 1 running BEFORE it's even set. Indent both if's under where you set {_random}. Because it's checking as soon as you open the GUI, not after the crate has been opened.

rose city STICKER

RosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaR

i code, animate, develop, UI design, learn, and adapt, as well as make servers, of course

💐Joined Minehut sometime in 2014
💐VIP sometime in 2018
💐Legend in January 2021
💐Helper on 4/11/2021
💐♥ (Retired) on 5/17/2021
💐 Moderator on 8/18/2023

Link to comment
Share on other sites

On 8/18/2021 at 10:00 PM, Dragon-Master said:

I have this skript, and i don't know why it doesn't work... Help?

command /shop:
    trigger:
        open virtual chest inventory with size 5 named "&6Crates" to player
        format gui slot 11 of player with {crate::1} named "&fBasic Crate" with lore "&7[&fCosts 1 &bDiamond&7]" to run:
            if player's inventory has 1 diamond:
                remove 1 diamond from player's inventory
                set {_random} to random integer between 1 and 2
        if {_random} is 1:
            send "&7You opened a crate and found: &b1 diamond&7!" to player
            give player 1 diamond
        else:
            if {_random} is 2:
                send "&7You opened a crate and found: &b2 diamonds&7!" to player
                give player 2 diamonds
               
command /itemset [<text>]:
    trigger:
        set {crate::%arg 1%} to player's held item

the answer has already been given, but I just wanna say you can do  else if {random_} is 2:
 

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