Cooldown message 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 community!

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

Vic

Member
Mar 30, 2021
1
0
1
Heyy! I just wrote a code which makes a specific item shoot a wither skull, and I wanted to add a cooldown message, but when I try it it just returns with "In cooldown for <none> seconds, here's the code.

Code:
on rightclick holding wither rose:
    if player is holding a wither rose named "&c&lSKULLSHOOTER":
        if  {wither.%player's uuid%}  < 1:
            shoot wither skull at speed 1
            add 1 to {wither.%player's uuid%}
            set {_cooldown} to difference between {withercd.%player's uuid%} and now
            play sound "entity.wither.shoot" with volume 0.5 to the player
            wait 2 seconds
            send action bar "&2&lReady to use!" to player
            play sound "entity.experience_orb.pickup" with volume 0.5 to the player
            set {wither.%player's uuid%} to 0
        else:
            send action bar "&c&lIn cooldown for %difference between 2 seconds and {_cooldown}% seconds." to player
"
 
Code:
every second in "world":
 loop all players:
  if {%loop-player%.withercool} is more than 0:
   remove 1 from {%loop-player%.whitercool}

on right click:
 if player's held item is slimeball named "Skull Shooter":
  if {%player%.withercool} is more than 0:
   send "You still have to wait %{%player%.withercool}% seconds to use that!"
  if {%player%.withercool} is 0:
   shoot wither skull at speed 1
   play sound "entity.wither.shoot" with volume 0.5 to the player

Try this