Loop item fix

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

varboosted

Active Member
Apr 20, 2020
50
3
8
24
Hello i've created loop item skript but it is not working, i need help thanks for everyone who is trying to help!

Code:
on death:
    wait 3 ticks
    loop all items in inventory of victim:
        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
        wait 20 seconds
    loop all items in inventory of victim:
        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
        send message "&cYou need to select a kit! &7(&bAuto Kick in &l40 &bSeconds&7)" to the player
        wait 20 seconds
    loop all items in inventory of victim:
        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
        send message "&cYou need to select a kit! &7(&bAuto Kick in &l20 &bSeconds&7)" to the player
        wait 10 seconds
    loop all items in inventory of victim:
        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
        send message "&cYou need to select a kit! &7(&bAuto Kick in &l10 &bSeconds&7)" to the player
        wait 10 seconds
    loop all items in inventory of victim:
        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
        make player execute command "/leave"
        send message "&cYou didn't select a kit so you left the game!" to the player

I tried removing the
Code:
    loop all items in inventory of victim:
        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
It sending messages but even if you don't have the diamond sword you get kicked.

And if you can on world change will be wayyy better than on death, i just don't know how to do on world change
 
I assume you are wanting the loop all items, to happen again after the wait 20/10 seconds, in that case the code would be:

Code:
on death:
    wait 3 ticks
    loop all items in inventory of victim:
        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
        wait 20 seconds
        loop all items in inventory of victim:
            if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
            send message "&cYou need to select a kit! &7(&bAuto Kick in &l40 &bSeconds&7)" to the player
            wait 20 seconds
            loop all items in inventory of victim:
                if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
                send message "&cYou need to select a kit! &7(&bAuto Kick in &l20 &bSeconds&7)" to the player
                wait 10 seconds
                loop all items in inventory of victim:
                    if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
                    send message "&cYou need to select a kit! &7(&bAuto Kick in &l10 &bSeconds&7)" to the player
                    wait 10 seconds
                    loop all items in inventory of victim:
                        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
                        make player execute command "/leave"
                        send message "&cYou didn't select a kit so you left the game!" to the player
 
I assume you are wanting the loop all items, to happen again after the wait 20/10 seconds, in that case the code would be:

Code:
on death:
    wait 3 ticks
    loop all items in inventory of victim:
        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
        wait 20 seconds
        loop all items in inventory of victim:
            if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
            send message "&cYou need to select a kit! &7(&bAuto Kick in &l40 &bSeconds&7)" to the player
            wait 20 seconds
            loop all items in inventory of victim:
                if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
                send message "&cYou need to select a kit! &7(&bAuto Kick in &l20 &bSeconds&7)" to the player
                wait 10 seconds
                loop all items in inventory of victim:
                    if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
                    send message "&cYou need to select a kit! &7(&bAuto Kick in &l10 &bSeconds&7)" to the player
                    wait 10 seconds
                    loop all items in inventory of victim:
                        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
                        make player execute command "/leave"
                        send message "&cYou didn't select a kit so you left the game!" to the player
 

Attachments

  • upload_2020-6-6_21-42-26.png
    upload_2020-6-6_21-42-26.png
    97.3 KB · Views: 126
Also, if you want it to be on world change just do,

on player world change:
[doublepost=1591469158,1591468961][/doublepost]
Sorry, here you go

Code:
on death:
    wait 3 ticks
    loop all items in inventory of victim:
        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
            wait 20 seconds
            loop all items in inventory of victim:
                if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
                    send message "&cYou need to select a kit! &7(&bAuto Kick in &l40 &bSeconds&7)" to the player
                    wait 20 seconds
                    loop all items in inventory of victim:
                        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
                            send message "&cYou need to select a kit! &7(&bAuto Kick in &l20 &bSeconds&7)" to the player
                            wait 10 seconds
                            loop all items in inventory of victim:
                                if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
                                    send message "&cYou need to select a kit! &7(&bAuto Kick in &l10 &bSeconds&7)" to the player
                                    wait 10 seconds
                                    loop all items in inventory of victim:
                                        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
                                            make player execute command "/leave"
                                            send message "&cYou didn't select a kit so you left the game!" to the player
 
Also, if you want it to be on world change just do,

on player world change:
ok first of all there is errors:
upload_2020-6-6_21-43-54.png


secondly it is spamming
upload_2020-6-6_21-44-11.png


and when i'm selecting a kit it still making me execute the command and sending me messages
[doublepost=1591469360,1591469186][/doublepost]
I assume you are wanting the loop all items, to happen again after the wait 20/10 seconds, in that case the code would be:

Code:
on death:
    wait 3 ticks
    loop all items in inventory of victim:
        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
        wait 20 seconds
        loop all items in inventory of victim:
            if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
            send message "&cYou need to select a kit! &7(&bAuto Kick in &l40 &bSeconds&7)" to the player
            wait 20 seconds
            loop all items in inventory of victim:
                if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
                send message "&cYou need to select a kit! &7(&bAuto Kick in &l20 &bSeconds&7)" to the player
                wait 10 seconds
                loop all items in inventory of victim:
                    if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
                    send message "&cYou need to select a kit! &7(&bAuto Kick in &l10 &bSeconds&7)" to the player
                    wait 10 seconds
                    loop all items in inventory of victim:
                        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
                        make player execute command "/leave"
                        send message "&cYou didn't select a kit so you left the game!" to the player

Doesn't works and also
upload_2020-6-6_21-49-15.png
 
Try this:

Code:
on death:
    wait 3 ticks
    loop all items in inventory of victim:
        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
            wait 20 seconds
            loop all items in inventory of victim:
                if loop-item-2 is diamond sword named "&bKit Selector &7(Right-click)":
                    send message "&cYou need to select a kit! &7(&bAuto Kick in &l40 &bSeconds&7)" to the player
                    wait 20 seconds
                    loop all items in inventory of victim:
                        if loop-item-3 is diamond sword named "&bKit Selector &7(Right-click)":
                            send message "&cYou need to select a kit! &7(&bAuto Kick in &l20 &bSeconds&7)" to the player
                            wait 10 seconds
                            loop all items in inventory of victim:
                                if loop-item-4 is diamond sword named "&bKit Selector &7(Right-click)":
                                    send message "&cYou need to select a kit! &7(&bAuto Kick in &l10 &bSeconds&7)" to the player
                                    wait 10 seconds
                                    loop all items in inventory of victim:
                                        if loop-item-5 is diamond sword named "&bKit Selector &7(Right-click)":
                                            make player execute command "/leave"
                                            send message "&cYou didn't select a kit so you left the game!" to the player
 
Try this:

Code:
on death:
    wait 3 ticks
    loop all items in inventory of victim:
        if loop-item is diamond sword named "&bKit Selector &7(Right-click)":
            wait 20 seconds
            loop all items in inventory of victim:
                if loop-item-2 is diamond sword named "&bKit Selector &7(Right-click)":
                    send message "&cYou need to select a kit! &7(&bAuto Kick in &l40 &bSeconds&7)" to the player
                    wait 20 seconds
                    loop all items in inventory of victim:
                        if loop-item-3 is diamond sword named "&bKit Selector &7(Right-click)":
                            send message "&cYou need to select a kit! &7(&bAuto Kick in &l20 &bSeconds&7)" to the player
                            wait 10 seconds
                            loop all items in inventory of victim:
                                if loop-item-4 is diamond sword named "&bKit Selector &7(Right-click)":
                                    send message "&cYou need to select a kit! &7(&bAuto Kick in &l10 &bSeconds&7)" to the player
                                    wait 10 seconds
                                    loop all items in inventory of victim:
                                        if loop-item-5 is diamond sword named "&bKit Selector &7(Right-click)":
                                            make player execute command "/leave"
                                            send message "&cYou didn't select a kit so you left the game!" to the player
Works but it spams the message
upload_2020-6-6_22-3-42.png

and can i make also a title it will be better?
thank you for helping me !
 
Status
Not open for further replies.