Lets say that I have a touched event:
local part = script.Parent part.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then -- do whatever end end)
This would work for things like body parts, but if I added an effect (lets say like a translucent part or sphere or something) and parented it to the character, then it would also think that the effect is also a body part. What is the best/most efficient way to stop this? My current solution is parenting the effect to the characters head or something, so it doesn't detect my effect as a body part.
I'm not sure what you mean by effect, since particle emitters or lights cannot trigger the touched event. But if you don't want a part to be touched, you can turn off the CanTouch property for that part.
Maybe check the children inside of that instance. Like if the instance has children similar to a body part, you just claim it as a body part. Like this code example:
local Part = -- the part in the workspace which is going to be handling the event Part.Touched:Connect(function(hit) if hit:FindFirstChild("Anything similar to a body part inside of it (Motor3D, etc)") then print("Print whatever inside of here") end end)
Sorry if it's too messy. But I think that will work for you.