Ninjabuilderpro Posted March 5, 2021 Share Posted March 5, 2021 I have a script that makes a Lightning Wand that summons lightning when you right click. I want to add a 4 second cooldown so you can't just spam lightning. Im using 1.16.5 and heres the script. command /lightningwand <player>: aliases: lw usage: &7[&6LW&7] &cWho do you want to give the wand? permission: lw.give trigger: if arg-1 is set: give player 1 stick named "&f&lLightning Wand" with lore "&7Summons lightning where you looking at" else: stop on rightclick: #you can also change it to leftclick if player's tool is stick named "&f&lLightning Wand" with lore "&7Summons lightning where you looking at": strike lightning at the targeted block else: stop Link to comment Share on other sites More sharing options...
_omga Posted March 5, 2021 Share Posted March 5, 2021 (edited) on rightclick: #you can also change it to leftclick if player's tool is stick named "&f&lLightning Wand" with lore "&7Summons lightning where you looking at": if {wandCooldown::%player%} > 0: send "This is on cooldown!" stop set {wandCooldown::%player%} to 10 # The amount of time in seconds the cooldown is. strike lightning at the targeted block loop 10 times: # The amount of time in seconds the cooldown is. wait 1 second remove 1 from {wandCooldown::%player%} else: stop Edited March 5, 2021 by _omga If I helped you at all, leave a like! IGN: _omga Discord: omega#1000 Link to comment Share on other sites More sharing options...
Ninjabuilderpro Posted March 6, 2021 Author Share Posted March 6, 2021 The Wand still has no cooldown Link to comment Share on other sites More sharing options...
_omga Posted March 6, 2021 Share Posted March 6, 2021 Are there any errors? If I helped you at all, leave a like! IGN: _omga Discord: omega#1000 Link to comment Share on other sites More sharing options...
_Tarna_ Posted March 6, 2021 Share Posted March 6, 2021 Here is a cool function you can use to manage cooldowns easily. There also are examples in it so you can look at to see how to use it. https://pastebin.com/raw/UTtFBK76 Discord - tarna256 In-game name - _Tarna_ Website - https://tarna.dev Paste Site: https://paste.tarna.dev --------------------------------------------------------- [VIP] - 7/27/2020 Support - 7/8/20 | 11/3/20 Helper - 11/3/20 - 2/21/21 Moderator - 2/21/21 - 5/17/21 - 5/17/21 - now Moderator - 12/20/22 - now --------------------------------------------------------- Link to comment Share on other sites More sharing options...
Ninjabuilderpro Posted March 6, 2021 Author Share Posted March 6, 2021 12 hours ago, _omga said: Are there any errors? No errors just no cool down Link to comment Share on other sites More sharing options...
Ninjabuilderpro Posted March 8, 2021 Author Share Posted March 8, 2021 Im not sure if i'm using it wrong but I still can't get a working cooldown with the function. Here is what I've got on rightclick: #you can also change it to leftclick if player's tool is stick named "&f&lLightning Wand" with lore "&7Summons lightning where you looking at": cooldownManager(player, "Lightning Wand", 10 seconds) isn't set strike lightning at the targeted block else: stop Link to comment Share on other sites More sharing options...
nicholxs Posted March 12, 2021 Share Posted March 12, 2021 On 3/9/2021 at 5:16 AM, Ninjabuilderpro said: Im not sure if i'm using it wrong but I still can't get a working cooldown with the function. Here is what I've got on rightclick: #you can also change it to leftclick if player's tool is stick named "&f&lLightning Wand" with lore "&7Summons lightning where you looking at": cooldownManager(player, "Lightning Wand", 10 seconds) isn't set strike lightning at the targeted block else: stop Try debug it; does the cooldownManager line actually trigger? add a broadcast just before it to check if it triggers when you rightclick the item. Then test the cooldownManager with other commands to see if it's working or not. Essentially, you're trying to figure out what's not working to fix it. First Joined: July 2015VIP: January 2020Jr.Mod: 1st April 2020Mod: 16th July 2020Info:~ Skript Developer ~ Discord: @nicholxs#0001 ~ Previous names: Nichxlxs, Deterno, iHaveSkills, Retrical Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now