Debounce not working

I believe not deb2 and deb2 == false do the exact same thing. : )

I’m sorry, I have no clue why it isn’t working properly. : (

Did you try setting it up using the touched even and things?

is the event even firing? need characters to post -_-

Yes the event is firing the frame becomes visible but the click fires too many times

I don’t really need to set it all up to test it, It should work with the example I provided, try substituting my example with the current segment in the code.

Are you passing the deb2 through the event?

I did try that but still same result!

local deb2 = false
plrsGui.speechFrame.speech.MouseButton1Up:Connect(function()
    if deb2 == false then
        deb2 = true
        print("Clicked")
        --scroll()
        wait(2)
        deb2 = false
    end
end)
1 Like

No I am not passing it through the event

your script ^^^

here’s how I do it:

plrsGui.speechFrame.speech.MouseButton1Up:Connect(function()
    if not deb2 then
        deb2 = true
	    print("Clicked")
	    --scroll()
    end
     wait(2)
     deb2 = false
end)

usually when using debounce, you would put the wait() function under the if statement if that makes sense. That usually works for me

Alright, hmmmmmmmmmmmmmmmmmmmmmmm
I’m out of ideas, i’m sorry friend.

please try this if this doesnt work its a bug

Yes tat is how I usually do it but I’ve tried like 5 different ways and nothing worked including this one!

I did try that same results! This is very annoying!

It’s a bug then, Try relaunching your studio. Maybe it’ll fix itself?
EDIT: another. thing that could happen, naming two variables the same thing in the same script?

Relaunched for the 5th time and still the same things! Who knew something so easy can be so painful!

try to make another script. once that happened to me and new script fixed it

hmmmm.
maybe try printing out some things

plrsGui.speechFrame.speech.MouseButton1Up:Connect(function()
    if not deb2 then
        deb2 = true
	    print("Debounce on")
	    --scroll()
    end
     wait(2)
     deb2 = false
     print("Debounce off")
end)

see if you get some results from the output

1 Like

Sorry it took so long for the reply but what I have found is now it fires 7x then you wait the 2 seconds then you can do it again and the same thing happens.

1 Like