Does disconnectiong connections with other connections inside disconnects the connections inside them?

Too many connections


Basically this:

local Connection1 = Event:Connect(function()
	print("hi")
	local Connection2 = Event2:Connect(function()
		print("hello")
	end)
end)
wait(2)
Connection1:Disconnect() -- does Connection2 gets disconnected?

I think not. But it’s very easy to test it out.

Yeah, apparently it doesn’t. That will cause a huge memory drop…

Simply read it line by line:
Connection1 is created which listens for Event to be fired.
Upon Event being fired Connection2 is created which listens for Event2
Code yields for 2 seconds
Connection1 is disconnected

If Event is fired then Connection2 will still connected and listening.

No, in this case Connection2 would not be disconnected and when “Event” is fired again a new connection is created for “Event2”.