enemy death problem

I have a problem that occurs when ever an enemy dies. what happens is the enemy and all the parts of it decide to go underneath the map, and seemingly disappear. this is annoying, because i want my enemy to fall apart. i do this by using this script, which i attach to all the parts of the enemy:

var snowman : Transform;
var sphere : boolean;

function Update () {
	if (snowman.GetComponent(EnemyHealth).dead == true) {
		gameObject.AddComponent("Rigidbody");
		
		transform.parent = null;
		
		if (sphere == true) {
			gameObject.AddComponent("Sphere Collider");
		}
		
		else if (sphere == false) {
			gameObject.AddComponent("Capsule Collider");
		}
	}
}

and the enemy AI code:

var target : Transform;
var damp = 5.0;
var speed = 3.0;

function Start () {
	// Auto setup player as target through tags
	if (target == null  GameObject.FindWithTag("Player"))
		target = GameObject.FindWithTag("Player").transform;
}

function Update () {
	if (target  Vector3.Distance(transform.position, target.position) < 30) {
		var rotate = Quaternion.LookRotation(Vector3(target.position.x, transform.position.y, target.position.z) - transform.position);
		transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp);
		
		var controller : CharacterController = GetComponent(CharacterController);
		
		var forward : Vector3 = transform.TransformDirection(Vector3.forward);
		controller.SimpleMove(forward * speed);
		
		Debug.Log("I'm Attacking!!!");
	}
	
	else if (target  Vector3.Distance(transform.position, target.position) > 30) {
		Debug.Log("I'm not Attacking!!!");
	}
}

Does the console show any runtime errors? Try using AddComponent( SphereCollider ) and CapsuleCollider instead of the strings. It sounds like the colliders aren’t being added properly.

no, the colliders are working fine. the only thing that isnt is the position. for some reason, the position is getting set funnily as soon as they are unparented

When you add the collider to the objects, are they intersecting? Physics doesn’t like it when two things exist in the same place at the same time and generally funky things start to happen when that’s the case.

yes, they kinda are. here, ill show you: