Cooldown for Right Clicking with a item

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

Aarush Jain

Member
Oct 22, 2023
11
0
1
24
I want to make a cooldown for player to right click with a Redstone and a cooldown of 100 seconds starts. if the player right clicks with Redstone while the cool down is on ,a message pops up to wait till the cooldown ends

Code:
variables:
{redstone.cd} = 100
on right click with redstone:
    if {cooldown.item::%player%} is not set:
        set {cooldown.item::%player%} to difference between {redstone.cd} and now
    else:
        if {cooldown.item::%player%} is less than {redstone.cd} seconds:
            send "&cYou Need To Wait Ofr the Cooldown to end for you to again use this item"
            stop
        else:
            execute command "/effect give speed 40 1" by player
            stop
 
I want to make a cooldown for player to right click with a Redstone and a cooldown of 100 seconds starts. if the player right clicks with Redstone while the cool down is on ,a message pops up to wait till the cooldown ends

Code:
variables:
{redstone.cd} = 100
on right click with redstone:
    if {cooldown.item::%player%} is not set:
        set {cooldown.item::%player%} to difference between {redstone.cd} and now
    else:
        if {cooldown.item::%player%} is less than {redstone.cd} seconds:
            send "&cYou Need To Wait Ofr the Cooldown to end for you to again use this item"
            stop
        else:
            execute command "/effect give speed 40 1" by player
            stop
Code:
variables:
    {redstone.cd} = 100

on right click with redstone:
    if {cooldown.item::%player%} is not set:
        set {cooldown.item::%player%} to difference between {redstone.cd} and now
    if {redstone.cd} is greater than {cooldown.item::%player%}:
        send "&cYou Need To Wait for the Cooldown to end for you to again use this item"
        stop
    else:
        execute command "/effect give speed 40 1" by player
        stop

This should be good. BTW mark this post as solved
 
Code:
variables:
    {redstone.cd} = 100

on right click with redstone:
    if {cooldown.item::%player%} is not set:
        set {cooldown.item::%player%} to difference between {redstone.cd} and now
    if {redstone.cd} is greater than {cooldown.item::%player%}:
        send "&cYou Need To Wait for the Cooldown to end for you to again use this item"
        stop
    else:
        execute command "/effect give speed 40 1" by player
        stop

This should be good. BTW mark this post as solved
Doesn't work we can get the effects within the cooldown ;-;
1702742132949.png
 
variables:
{redstone.cd} = 100

on right click with redstone:
if player’s tool contains “(Prefix or Text Here”:
if {cooldown.item::%player%} is not set:
set {cooldown.item::%player%} to difference between {redstone.cd} and now
execute command "/effect give speed 40 1" by player
else:
send “&4You are on Cooldown now!” # Or type other things
 
variables:
{redstone.cd} = 100

on right click with redstone:
if player’s tool contains “(Prefix or Text Here”:
if {cooldown.item::%player%} is not set:
set {cooldown.item::%player%} to difference between {redstone.cd} and now
execute command "/effect give speed 40 1" by player
else:
send “&4You are on Cooldown now!” # Or type other things
I can fix it today I think
 
Kindly Reply me whenever the final code which works is done till then check this code,
I can fix it today I think

I tried to make it work (it reloads but I don't think so it works)

Code:
on right click with redstone:
    {kitpvp::%player%} is true:
        if {cooldown.end.%player%} isn't set:
            set {_now} to now
            set {cooldown.end.%player%} to {_now} + {redstone.cd}
            execute console command "effect give %player% speed 45 1"
        if {cooldown.end.%player%} is set:
            if {cooldown.end.%player%} <= now:
                message "&byou have been given speed"
                execute console command "effect give %player% speed 45 1"
            if {cooldown.end.%player%} > now:
                message "&6you have to wait" to player
                stop      
                cancel event
variables:
    {redstone.cd} = 3 minutes


{kitpvp::%player%} is a variable that I want to be set for this code to be run.