How do I check for parts welded to anchored parts effectively?

I am trying to optimize explosions and their effects in my game by having parts that get blown up by an explosion have their NetworkOwner set to the shooter that generated said explosion.

The issue is, some of the parts in my game have been welded to the anchored floor, to prevent players and vehicles from pushing them around. And any part, even if it is ten parts removed from the anchored part, that is welded to this anchored part, cannot have its NetworkOwner set to the player.

Obviously, it seems like ROBLOX has a way to effectively and quickly detect if a part is connected to an anchored part by welds - how would I be able to emulate/access this? The way I am thinking is to run a bunch of for loops parsing each part and its respective welds, but obviously, that does not seem very effective.

2 Likes