--[=[
	Connects a handler to a ScriptSignal object, but only allows that
	connection to run once. Any `:Fire` calls called afterwards won't trigger anything.

	```lua
	ScriptSignal:ConnectOnce(function()
		print("Connection fired")
	end)

	ScriptSignal:Fire()
	ScriptSignal:Fire()

	-- "Connection fired" is only fired once
	```

	@param handler (...: any) -> ()
	@ignore
]=]

function ScriptSignal:ConnectOnce(handler: (...any) -> ())
    assert(typeof(handler) == "function", "Must be function")

    local connection
    connection = self:Connect(function(...)
        connection:Disconnect()
        handler(...)
    end)
end
