Jump to content
  • 0

Need help with skript


Thatdisplayname

Question

So i have this code:

options:
    {Time} : 1
    
command /items:
    trigger:
        if {%player%.random} = true:
            set {%player%.random} to false
            message "&7You have disabled random items" to player
        else:
            set {%player%.random} to true
            message "&7You have enabled random items" to player
    
every {Time} seconds:
    loop all players:
        if {%loop-player%.random} = true:
            give loop-player a random item of all items
            wait 1 tick

And everything works except the "every {Time} seconds:" part, and it gives me this message:image.png.47df128be6baa842b90a87ed66b50ac8.png

How do I fix this? (please explain in simple terms)

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
1 minute ago, Thatdisplayname said:

So i have this code:

options:
    {Time} : 1
    
command /items:
    trigger:
        if {%player%.random} = true:
            set {%player%.random} to false
            message "&7You have disabled random items" to player
        else:
            set {%player%.random} to true
            message "&7You have enabled random items" to player
    
every {Time} seconds:
    loop all players:
        if {%loop-player%.random} = true:
            give loop-player a random item of all items
            wait 1 tick

And everything works except the "every {Time} seconds:" part, and it gives me this message:image.png.47df128be6baa842b90a87ed66b50ac8.png

How do I fix this? (please explain in simple terms)

options:
    {Time} : 1
    
command /items:
    trigger:
        if {%player%.random} = true:
            set {%player%.random} to false
            message "&7You have disabled random items" to player
        else:
            set {%player%.random} to true
            message "&7You have enabled random items" to player
    
every {@Time} seconds:
    loop all players:
        if {%loop-player%.random} = true:
            give loop-player a random item of all items
            wait 1 tick

When you use a option you need to put a "@" in front otherwise it will think it as a variable

i like skript...

 

sometimes.

Link to comment
Share on other sites

  • 0

FIXED 
i fixed it myself, just had to remove the {}

Finished code if anyone wants it

 

command /items:
    trigger:
        if {%player%.random} = true:
            set {%player%.random} to false
            message "&7You have disabled random items" to player
        else:
            set {%player%.random} to true
            message "&7You have enabled random items" to player
options:
    Time : 1

every {@Time} seconds:
    loop all players:
        if {%loop-player%.random} = true:
            give loop-player a random item of all items
            wait 1 tick

 

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