Right Click on Compass Cooldown

  • 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 our Wiki for downloads and any other information about Skript!

Status
Not open for further replies.

SrirachaMC

Member
Feb 26, 2021
3
0
1
23
I wanted to see if I could put a 10 second cooldown on the right click of a compass. I also added code where it would remove the compass after 3 uses.
Here's what I have so far

on right-click with compass:
if name of tool of player is "Teleport":
add 1 to {n.%player%}
execute console command "msg SrirachaMC &e3"
wait 1 seconds
execute console command "msg SrirachaMC &c2"
wait 1 seconds
execute console command "msg SrirachaMC &41"
wait 1 seconds
make player execute command "tp SrirachaMC"
wait 10 seconds
if {n.%player%} = 3:
remove compass named "Teleport" from player's inventory
delete {n.%player%}

on respawn:
give player compass named "Teleport"

EDIT: Already solved, @Nikd0 helped in Discord
 
Last edited:
this thread was already resolved on discord (i'm sending it also here, please mark as resolved)
Code:
on right-click with compass:
    if name of tool of player is "Teleport":
        if {compasscooldown::%player%} is set:
            stop
        set {compasscooldown::%player%} to true
        add 1 to {n.%player%}
        execute console command "msg SrirachaMC &e3"
        wait 1 seconds
        execute console command "msg SrirachaMC &c2"
        wait 1 seconds
        execute console command "msg SrirachaMC &41"
        wait 1 seconds
        make player execute command "tp SrirachaMC" as op
        wait 10 seconds
        if {n.%player%} = 3:
            remove compass named "Teleport" from player's inventory
            delete {n.%player%}
        #you may add a wait here
        clear {compasscooldown::%player%}
 
Status
Not open for further replies.