If I disconnect a function, will the functions inside it also get disconnected?

I have this function:

-- Functions that check when a player dies
	if T1Player1 then
		table.insert(connections, T1Player1.CharacterRemoving:Connect(function(hit)
			T1Player1Dead = true
			T1Player1.CharacterAdded:Connect(function()
				checkDeaths()
			end)
		end))
	end

The this to disconnect them and stop them from running again:

for i, v in ipairs(connections) do
	v:Disconnect()	
end

table.clear(connections)

Basically my question is, after disconnecting them, will the player.CharacterAdded event still run, since its inside the characterRemoving event?

Yes, nested connections will still run if you don’t disconnect them

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.