Solved Cooldown issues

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

Oct 10, 2021
12
0
1
23
Code:
on left click:
  player is holding a blaze rod named "<gray>Necromancer Staff":
    {wand.effect.%player%} is 1:
      if {cooldown.%player%} is true:
              message "&6you have to wait"
              stop
              cancel event
          if {cooldown.%player%} isn't set:
              set {cooldown.%player%} to false
          if {cooldown.%player%} is false:
              set {cooldown.%player%} to true
        loop 4 times:
          spawn zombie at player
          set the weapon of last spawned entity to iron sword
          set the name of last spawned entity to "<black>Undead Captain"
          set last spawned entity's max health to 30
              wait 1 minute
              set {cooldown.%player%} to false
        stop

I am making a necromancer staff but I have issues with the cooldown
 
Code:
on left click:
  player is holding a blaze rod named "<gray>Necromancer Staff":
    {wand.effect.%player%} is 1:
      if {cooldown.%player%} is true:
              message "&6you have to wait"
              stop
              cancel event
          if {cooldown.%player%} isn't set:
              set {cooldown.%player%} to false
          if {cooldown.%player%} is false:
              set {cooldown.%player%} to true
        loop 4 times:
          spawn zombie at player
          set the weapon of last spawned entity to iron sword
          set the name of last spawned entity to "<black>Undead Captain"
          set last spawned entity's max health to 30
              wait 1 minute
              set {cooldown.%player%} to false
        stop

I am making a necromancer staff but I have issues with the cooldown
Code:
on left click with blaze rod:
    name of tool is "<gray>Necromancer Staff"
    {wand.effect.%player%} is 1:
        if unix date of ((metadata tag "cooldown" of player) ? 0) wasn't less than 1 minute ago:
            set metadata tag "cooldown" of player to unix timestamp of now
            loop 4 times:
                spawn zombie at player
                set tool of last spawned zombie to iron sword
                set display name of last spawened zombie to "<black>Undead Captain"
                set max health of last spawned zombie to 30
                heal last spawned zombie
        else:
            send "Cooldown message!"
try that (also try to change your variables to list variables)