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

why is debounce not working on a clear script?

Asked by 5 years ago

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

Log in to vote
2
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

Try this:

local particle = script.Parent

while true do
    particle.Enabled = not particle.Enabled
    wait(2)
end
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 Rare_tendo 3000 — 5y
Ad

Answer this question