Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why is debounce not working on a clear script?

I want a particle emitter to turn on and off every 2 seconds, but the debounce is 'glitched' this is on a server script

while true do
	local dbo = false
	local particle = script.Parent
	
	if dbo == false then
		dbo = true
		particle.Enabled = false
	else
		dbo = false
		particle.Enabled = true
	end
	wait(2)
	print(dbo)
end

1 answer

✓ Accepted answer

Try this:

local particle = script.Parent

while true do
    particle.Enabled = not particle.Enabled
    wait(2)
end

1 comment

0

What you were doing wrong it your script is that every time you the loop runs, you're changing dbo's value to false

This discussion is preserved as it was. New answers, comments, and votes are closed.