Name is undefined, did you set it to "Left Leg" somewhere above the part of the script you posted? And same with parent. You also want to do it when their character is added.
But if you don't really know, this should work fine (to remove the CharacterMeshes):
01 | game.Players.PlayerAdded:connect( function (player) |
02 | player.CharacterAdded:connect( function (character) |
04 | local children = character:GetChildren(); |
05 | for key = 1 , #children do |
06 | local value = children [ key ] ; |
07 | if value:IsA( "CharacterMesh" ) then |
Alternatively, you can set the CharacterAppearance property to someone who looks normal, or set the CanLoadCharacterAppearance property to false.
Edit: Fixed a problem with the script.