Problem with a debounce script

Can someone hive me a hand on why the debounce dosent work?

Why do you have 2 ends?
image

I think for the end you mean this:
image

to:

    animation:Stop();
    wait(1);
    deb=false;
end);

That makes an error and hi-lights red. :frowning:

Can you screenshot?. Here is more text because character limit

Yes I can look its red.
Screen Shot 2022-02-20 at 9.03.02 PM

Can you screen shot everything, I mean

plz format ur document image

This is likely because you’re creating your connections inside of an if-statement inside of your activated connection. You should have three separate, non-nested connections.

Please explain what do you mean by this.

Your script should look something like this:

script.Parent.Activated:Connect(function()
    -- some stuff
end)
script.Parent.Equipped:Connect(function()
   -- some stuff
end)
script.Parent.Unequipped:Connect(function()
    -- some stuff
end)

Instead, your script looks like this:

script.Parent.Activated:Connect(function()
    if not debounce then
        script.Parent.Equipped:Connect(function()
            -- some stuff
        end)
    end
    script.Parent.Unequipped:Connect(function()
        -- some stuff
    end)
end)
1 Like

Okay ill try it. Thank you. This will problably help.

1 Like

I do not understand scripting that much but the script without the debounce works so what your showing me is what a non debounce script would look like.

I’m not sure I understand, since the variable can be accessed in all of the connections’ scopes, it would “sync” assuming you’re referencing that variable.

at this point imma just make my own debounce by disableing the script and enableing the script.