How to find where an event was triggered from?

Is there a way to find out what triggered an event?

I’m having a problem when a player fires a weapon where the projectile travels the distance between the end of the weapon barrel and the target, the player is immediately teleported by the last teleporter they used. What makes this difficult to diagnose is that there is absolutely no connection between the weapons system and the teleporter system. Yet, the moment when the projectile is added to the workspace, the teleport is triggered.

At this point, I’m not sure if it’s something in my code or if there’s a bug in the engine.

EDIT:

I forgot to mention that with debug.traceback(), it will only go back to the event connection and it will not tell me what triggered the event. However, the hitpart from the Touch event is always HumanoidRootPart or Handle when this happens, so I’ve developed a workaround to deal with it. But I would really like to know what the problem is.

try checking your code, and if it’s a bug from the engine, then contact @Bug-Support

I’ve gone through my code, several times. I know for a fact that when the projectile parent is set to game.Workspace, the teleport happens. When it’s not added to the Workspace, the teleport isn’t triggered.

As I said, there is no connection between the teleporter code and the weapons code. The two systems are even under different loaders. It’s almost like there’s some kind of crosslink happening between the two even though they should be isolated from each other.