#I need Help with a cooldown

1 messages · Page 1 of 1 (latest)

crimson cipher
#

i have a skript witch will execute something on inventory click. What can i do to make a cooldown for clicking the item.
That u are only able to execute the command on clicking the item every 5 seconds.

#

this is my skript: ```on inventory click:
name of event-item is compass named "&eBack to spawn" with lore "&7<click>"
if {cooldown.%player%} is true:
send "&4&lError: &cYou need to wait more then 5 seconds to execute this again!"
cancel event
if {cooldown.%player%} isn't set:
set {cooldown.%player%} to false
if {cooldown,%player%} is false:
set {cooldown.%player%} to true
cancel event
close player's inventory
player command "/spawn"
play sound "block.note_block.bell" to player
wait 5 seconds
set {cooldown.%player%} to false

#

its not working

#

I got it

#

Here is my new skript:

#
  name of event-item is "&eBack to spawn"
  if {cooldown.%player%} is true:
    send "&4&lError: &cYou need to wait more then 3 seconds to execute this again!"
    cancel event
  name of event-item is "&eBack to spawn"
  if {cooldown.%player%} isn't set:
    set {cooldown.%player%} to false
  name of event-item is "&eBack to spawn"
  if {cooldown.%player%} is false:
    set {cooldown.%player%} to true
    cancel event
    close player's inventory
    player command "/spawn"
    play sound "block.note_block.bell" to player
    wait 3 seconds
    set {cooldown.%player%} to false