Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to add a cool-down to this script? - I'm really new to this

Asked by 6 years ago

Hey guys, I'm REALLY new to scripting so this might be really easy for all you professionals out there, aha.

But, do you know how to add a cool-down to this simple script? It'd be really appreciated. <3

local plr = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()

plr.Character.Humanoid.WalkSpeed = 25 -- your power up

plr.Character.Humanoid.JumpPower = 100 -- your power up

wait(5) -- after 5 sec back to V

plr.Character.Humanoid.WalkSpeed = 16 -- back to normal

plr.Character.Humanoid.JumpPower = 50 -- back to normal

end)

0
use a bool variable DeceptiveCaster 3761 — 6y
0
Use a Debounce DragRacer31 7 — 6y
0
use debounce its much easier. just search it up. loads of tutorials on it. tonyv537 95 — 6y
0
hmm after the end (or before) add a wait() AnotherPerson_999 28 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Here is the original script:

01local plr = game.Players.LocalPlayer
02 
03script.Parent.MouseButton1Click:connect(function()
04 
05plr.Character.Humanoid.WalkSpeed = 25 -- your power up
06 
07plr.Character.Humanoid.JumpPower = 100 -- your power up
08 
09wait(5) -- after 5 sec back to V
10 
11plr.Character.Humanoid.WalkSpeed = 16 -- back to normal
12 
13plr.Character.Humanoid.JumpPower = 50 -- back to normal
14 
15end)

Try using this script:

01Debounce = true
02 
03local plr = game.Players.LocalPlayer
04 
05script.Parent.MouseButton1Click:connect(function()
06    if Debounce then
07Debounce = false
08 
09 
10plr.Character.Humanoid.WalkSpeed = 25 -- your power up
11 
12plr.Character.Humanoid.JumpPower = 100 -- your power up
13 
14wait(5) -- after 5 sec back to V
15 
View all 21 lines...

^ Hope that helps! :D

0
Didn't work. Thanks for trying though! If the script I sent is incorrect, please feel free to change it. TheObviousNinja 19 — 6y
0
hover your mouse over the code, click "view source" shown as an icon as a page with a <>, copy the code from that window, it probably gave an error because 1. copying straight from the page copies the numbers on the right (which is not good), 2. you need to press view all 21 lines, 3. what is script.Parent? fanofpixels 718 — 6y
Ad

Answer this question