How to make it to where when the item is unequipped the effect is gone

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

KatNA

Member
Jun 20, 2024
1
0
1
command test:
permission: op
trigger:
give {item::CritPick} to player

on right click:
1 of player's held item = item("critpick")
set metadata value "cooldown" of player to metadata value "cooldown" of player ? now
difference between metadata value "cooldown" of player and now > 60 seconds:
if "%item cooldown of player's tool for player%" is "0 seconds":
set item cooldown of player's tool for player to 60 seconds
set metadata value "cooldown" of player to now
apply haste 5 without particles whilst hiding icon to player for 15 seconds replacing existing effect
on player's held item change:
apply haste 1 without particles whilst hiding icon to player for 1 seconds replacing existing effect
else:
send action bar "&bwait %seconds of 60 seconds - difference between metadata value "cooldown" of player and now% seconds before you can use this again" to player