Function executing multiple times

Hello.
I want to create a function that runs 1 time after I click the LeftMouseButton.
Problem is, whenever I click the Mouse the animation plays 1 time (as it should) but the function runs 14 times.

Here is the script that sends the button click to the other script:

Here is the function that should run 1 time when called:

And here is the script that calls the function:

Thank you in advance !

2 Likes

well you put 2 mouse button down events remove one and lets see if it works

Can you please post your code in a code block instead of using images. It will be a lot easier to read.

2 Likes

did you make it false then wait by a delay and making it true again?

Still does not work, I put it there to add so combos in the future.

local Debounce = true

script.Parent.MouseButton1Click:Connect(function()
    if Debounce then
        Debounce = false
        print("test")
        wait(3) -- make it any number except 0
        Debounce = true
    end
end)

like that convert your code into that

are you sure that the two events run it multiple times cause you can spam click right click and left click at the same time

Debounce is truly your answer

6 Likes