Connected function can't connect a function to another event

Hello, so recently I’ve been facing this issue for months now, and I haven’t found any solution.

To reproduce this, you basically do this :-

SomeEvent:Connect(function()

	-- This connection wouldn't actually connect even though it does say "Connected" is true.
	local Connection = AnotherEvent:Connect(function()
		-- Anything here won't execute despite it being connected to the event.
	end)
	
	print(Connection.Connected)
end)

Does anybody know the solution / alternative to this?

This should only be reproducable under certain contexts.

Usually it should work fine like the player added and character added nested together in the Handling Events article for nested events.

However the issue might be when that by the time the connection was made the event already happened which isn’t being listened properly.

An example would be the special case for player added when the player joins before the player added event is connected as explained in this video:

So yeah watch out for those scenario’s, what’s your specific scenario though?

Well, I found this issue when I tried connecting a Touched event on a part from a module script, is that the reason why I couldn’t connect it?

Module scripts only run when required the first time within the script environment it was required in either locally or on the server, did you make sure to require it to run the code in the module script?

Yes, I required it from a server script in server script service.

Do parts need to be in workspace before you use the Touched Event? When I made a separate Server Script inside the part itself, it worked, but when I did it again on the module, it just never works. (It doesn’t make a TouchInterest either, which is a thing that gets created whenever you connect Touched.)

I don’t believe so.

Is the code even running in the first place when you use your module script method via print debug method?

It did, it even says the “Connected” is true, but it never actually fires it when another part interacts with it.

Are the parts anchored by any chance? From the BasePart | Roblox Creator Documentation documentation

This also means that at least one of the parts involved must not be BasePart.Anchored at the time of the collision.

If so then consider touched event with get touching parts instead.

Edit: it’s possible there are multiple problems, currently the post doesn’t have enough information, please try to make the reproduction steps more clear next time.

The part isn’t anchored, and using :GetTouchingParts() returns nothing. To clear it up abit, it’s actually a “RootPart” of a rig model (Not humanoid) that uses an Animation Controller rigged by joints. Could there be anything wrong involving that?

Oh well, I think I found the solution, my script destroys itself right after it connects a signal, meaning that signal gets destroyed too, so I found my way through this, though thanks either way.