Adding cooldown

  • 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 community!

    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!

habbic

Member
Mar 18, 2024
30
0
6
Code:
on right click:
    if event-item is diamond sword:
        if name of event-item is "&b&lWarden Sword":
            set {_warden} to difference between {did.%player%} and now
            if {_warden} < 10 seconds:
                send "&cYou are on cooldown. Remaining  is %difference between {_warden} and 10 seconds%" to player
                cancel event
                stop
                play sound "minecraft:entity.warden.sonic_boom" with volume 1 to all players within 6 blocks around the player
                loop blocks between block 1 infront of player and block 20 infront of player:
                    make 10 of sonic boom at loop-block
                    loop entities in radius 1.5 of loop-block:
                        damage loop-entity by 15 if loop-entity is not player
                        set {did.%player%} to now

So the skript broke complitly when i added a cooldown that dosent even work.
 
This section of the code will never run

Code:
lay sound "minecraft:entity.warden.sonic_boom" with volume 1 to all players within 6 blocks around the player
                loop blocks between block 1 infront of player and block 20 infront of player:
                    make 10 of sonic boom at loop-block
                    loop entities in radius 1.5 of loop-block:
                        damage loop-entity by 15 if loop-entity is not player
                        set {did.%player%} to now
 
Code:
on right click:
    if event-item is diamond sword:
        if name of event-item is "&b&lWarden Sword":
            set {_warden} to difference between {did.%player%} and now
            if {_warden} < 10 seconds:
                send "&cYou are on cooldown. Remaining  is %difference between {_warden} and 10 seconds%" to player
                cancel event
                stop
                play sound "minecraft:entity.warden.sonic_boom" with volume 1 to all players within 6 blocks around the player
                loop blocks between block 1 infront of player and block 20 infront of player:
                    make 10 of sonic boom at loop-block
                    loop entities in radius 1.5 of loop-block:
                        damage loop-entity by 15 if loop-entity is not player
                        set {did.%player%} to now

So the skript broke complitly when i added a cooldown that dosent even work.
yeah, Gamertop's right, you forgot to lower the indenting after when you said stop.