The touched event returns the part that touched the object in question. So if your leg touches a part, for example, your leg will be what the listener returns. If that's the case, when you touch a part and your function is run, your code is looking for the first child of the limb, not the player. To fix this you would change the code to
1 | local torso = hit.Parent:FindFirstChild( 'Torso' ) |
2 | local rightleg = hit.Parent:FindFirstChild( 'RightLeg' ) |
3 | local rightArm = hit.Parent:FindFirstChild( 'RightArm' ) |
4 | local leftLeg = hit.Parent:FindFirstChild( 'LeftLeg' ) |
5 | local leftArm = hit.Parent:FindFirstChild( 'LeftArm' ) |
6 | local headfoil = hit.Parent:FindFirstChild( 'Head' ) |
Also, the space between "connect" and the function in your listener seems unnecessary, but that could just be styling. Hope this helps!