Hello all,
As someone who doesn't yet have much experience with scripting yet, I run into these problems often. This is a part of a TweenService script that allows the door open when the button next to such door is clicked.
script.Parent.MouseClick:connect(function()
if open == false then
script.Parent.Sound:Play()
Open1:Play()
Open2:Play()
wait(15)
open = true
else
script.Parent.Sound:Play()
Close1:Play()
Close2:Play()
wait(15)
open = false
end
end)
I figured using a wait command would be a good way to make a 15 second cooldown for both the sound the door makes AND the door opening, but it only seems to be "cooling down" the ability to open the door, but the sound that the door itself makes can be constantly spammed if the door button is pressed a bunch of times, even when the door's open/close cooldown is still active.
My question is, how can I create a cooldown for the sound when the button is click in this portion of the script while maintaining the cooldown for the door itself to opened/closed?

2 comments
try indenting the wait(15) or putting it in the same line as the sound:Play()
"try indenting the wait(15) or putting it in the same line as the sound:Play()" i've tried this, but instead of making the sound have a cooldown it simply make the entire script wait 15 seconds before the door opens and the sound plays... i'll try intenting but it might not work