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

How to make my music touch pad have a cooldown?

Asked by 10 years ago

I don't want the songs to just be spammed anyone know how to make it have cooldown?

3 answers

Log in to vote
1
Answered by
reaper5 10
10 years ago

Use Debounce.

For Example.

local debounce = false
script.Parent.Touched:connect(function(hit)
if debounce==false then 
debounce = true
print("Reaper5 was here")

--script stuffings here

wait(2)
debounce = false
end
end)

That will make the event only be fired once (if touched) every two seconds.

Ad
Log in to vote
0
Answered by
Ekkoh 635 Moderation Voter
10 years ago

I'd create a boolean variable called enabled and only let the function run if enabled is set to true otherwise just return out of the function.

Log in to vote
0
Answered by 10 years ago

Look, This is Scripting Helpers we do not make scripts for other people. Hint on the Helpers just because it has helpers doesn't mean that we make scripts we fix and or repair the scripts.

  • Redstone Studios Corperation
0
dude im not asking on making it wolfbattle 5 — 10y
0
Making it is worse this is about scripting and "how to make it have cooldown?" How to make it you script it and we fix or repair it. RedstoneStudios 0 — 10y

Answer this question