Connected callback to a table seems to fire more than once

When assigning a connection to a table alongside their callback, it runs more than once causing an issue, is there any way around it?

local function ReturnConnectionToTable(Connection:RBXScriptSignal, Callback): ()
    if table.find(Connections, Connection:Connect(Callback)) then -- Trivial debug, does not a play a role.
        print(true, "Conection is already found")
    end
    table.insert(Connections, Connection:Connect(Callback))
end
ReturnConnectionToTable(Humanoid.Jumping, function(Jumping: boolean)
    warn("This will be fired more than once.")
 end)

Hey, it happens what’s said because the event is used one more time, supposedly to check whether the connection already exists, prior to inserting. It creates another RBXScriptConnection, which is not related to the one while using table.insert()

You know what I think, if I’m not mistaken, you could just use one connection and check inside.

local connections = {}

Humanoid.Jumping:Connect(function()
    if table.find(connections, "Jumping") then
        print("Already found one connection")
    else
        table.insert(connections, "Jumping")
    end
end)

Yeah but I need the connection to disconnect it, a string identifier isn’t gonna do much.

Initialize a local variable to assign the connection and then you can destroy it one more time it is fired.

local connections = {}

local conn1: RBXScriptConnection

conn1 = Humanoid.Jumping:Connect(function()
    if table.find(connections, "Jumping") then
        print("Already found one connection")
        conn1:Disconnect()
    else
        table.insert(connections, "Jumping")
    end
end)