Making a cooldown that shows on an action bar

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

HollowwwMC

New Member
Jul 14, 2024
6
0
1
18
I'm confused on how to make a cooldown and how to make it show up on the action bar. For example:
Code:
on right click:
    if player's tool is {customitem:coolsword}:
        apply strength 2 to player for 20 seconds
        apply speed 2 to player for 20 seconds
How would I make this have a cooldown and have it show on the action bar?
 
Here:

code_language.skript:
on right click:
    if player's tool is {customitem:coolsword}:
          set {coolswordcooldown::%player's uuid%} to 20
          apply strength 2 to player for 20 seconds
          apply speed 2 to player for 20 seconds

every second:
    if {coolswordcooldown::%player's uuid%} is more than 0:
        subtract 1 from {coolswordcooldown::%player's uuid%}
        send action bar "&cCooldown: %{coolswordcooldown::%player's uuid%}%" for 1 second
 
I would actually recommend like

code_language.skript:
on right click:
    if player's tool is {customitem:coolsword}:
        if {Cooldown::%player's uuid%} is set:
            stop
        else:
            set {Cooldown::%player's uuid%} to 30 #In seconds
            apply strength 2 to player for 20 seconds
            apply speed 2 to player for 20 seconds
            send action bar "&7Cooldown: %{Cooldown::%player's uuid%}%" to player
            while {Cooldown::%player's uuid%} is more than 0:
                wait 1 second
                remove 1 from {Cooldown::%player's uuid%}
                send action bar "&7Cooldown: %{Cooldown::%player's uuid%}%" to player
            delete {Cooldown::%player's uuid%}