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)
Here is the original script:
01 | local plr = game.Players.LocalPlayer |
02 |
03 | script.Parent.MouseButton 1 Click:connect( function () |
04 |
05 | plr.Character.Humanoid.WalkSpeed = 25 -- your power up |
06 |
07 | plr.Character.Humanoid.JumpPower = 100 -- your power up |
08 |
09 | wait( 5 ) -- after 5 sec back to V |
10 |
11 | plr.Character.Humanoid.WalkSpeed = 16 -- back to normal |
12 |
13 | plr.Character.Humanoid.JumpPower = 50 -- back to normal |
14 |
15 | end ) |
Try using this script:
01 | Debounce = true |
02 |
03 | local plr = game.Players.LocalPlayer |
04 |
05 | script.Parent.MouseButton 1 Click:connect( function () |
06 | if Debounce then |
07 | Debounce = false |
08 |
09 |
10 | plr.Character.Humanoid.WalkSpeed = 25 -- your power up |
11 |
12 | plr.Character.Humanoid.JumpPower = 100 -- your power up |
13 |
14 | wait( 5 ) -- after 5 sec back to V |
15 |
^ Hope that helps! :D