local debounce = true
local cooldown = 3
local Sound = script.Parent.Parent.Parent.taw.Sound
local Light = script.Parent.Parent.Parent.taw.Light
local Particle1 = script.Parent.Parent.Parent.taw.Particle1
local Particle2 = script.Parent.Parent.Parent.taw.Particle2
local ParticleEmitter1 = script.Parent.Parent.Parent.taw.ParticleEmitter1
local ParticleEmitter2 = script.Parent.Parent.Parent.taw.ParticleEmitter2
local ParticleEmitter3 = script.Parent.Parent.Parent.taw.ParticleEmitter3
local ParticleEmitter4 = script.Parent.Parent.Parent.taw.ParticleEmitter4
local ParticleEmitter5 = script.Parent.Parent.Parent.taw.ParticleEmitter5
local ParticleEmitter6 = script.Parent.Parent.Parent.taw.ParticleEmitter6
local ParticleEmitter7 = script.Parent.Parent.Parent.taw.ParticleEmitter7
local ParticleEmitter8 = script.Parent.Parent.Parent.taw.ParticleEmitter8
local ParticleEmitter9 = script.Parent.Parent.Parent.taw.ParticleEmitter9
local ParticleEmitter10 = script.Parent.Parent.Parent.taw.ParticleEmitter10
script.Parent.MouseClick:Connect(function()
if debounce then
debounce = false
end
Sound:Play()
Light.Enabled = true
Particle1.Enabled = true
Particle2.Enabled = true
ParticleEmitter1.Enabled = true
ParticleEmitter2.Enabled = true
ParticleEmitter3.Enabled = true
ParticleEmitter4.Enabled = true
ParticleEmitter5.Enabled = true
ParticleEmitter6.Enabled = true
ParticleEmitter7.Enabled = true
ParticleEmitter8.Enabled = true
ParticleEmitter9.Enabled = true
ParticleEmitter10.Enabled = true
wait(0.1)
Light.Enabled = false
Particle1.Enabled = false
Particle2.Enabled = false
ParticleEmitter1.Enabled = false
ParticleEmitter2.Enabled = false
ParticleEmitter3.Enabled = false
ParticleEmitter4.Enabled = false
ParticleEmitter5.Enabled = false
ParticleEmitter6.Enabled = false
ParticleEmitter7.Enabled = false
ParticleEmitter8.Enabled = false
ParticleEmitter9.Enabled = false
ParticleEmitter10.Enabled = false
wait(cooldown)
debounce = true
end)
COMMUNITY QUESTION
Anybody know why the debounce in this script isnt working?
2 answers
Your code is very messy so I'll fix your code and try and fix your debounce
local debounce = false
local cooldown = 3
local Sound = script.Parent.Parent.Parent.taw.Sound
local Light = script.Parent.Parent.Parent.taw.Light
for i, particles in pairs(script.Parent.Parent.Parent.taw:GetDescendants()) do
if particles:IsA("ParticleEmitter") then
ParticleEmmiters = particles
end
end
script.Parent.MouseClick:Connect(function()
if debounce == false then
debounce = true
end
end
Sound:Play()
Light.Enabled = true
ParticleEmmiters = true
wait(0.1)
Light.Enabled = false
ParticleEmmiters = false
wait(cooldown)
debounce = false
end)
I don't know if this works but tell me if something doesn't work!
for debouce use
local debounce = false -- put this on the top
if not debounce then -- add this in function
debounce = true
debounce = false -- add this after wait
This discussion is preserved as it was. New answers, comments, and votes are closed.

6 comments
It didnt work, by the way im a begginer scripter so i have a very hard time figuring out the problem
What are you even trying to make
I realized the problem, I had to add another end to the bottom. Was trying to make an explosion, thanks for the help
is GetDescendants different with GetChildren ?
GetDescendants gets every children plus the things inside of it, Get children only gets the children and not whats inside
If it works please accept my anwser