Ragdoll Not replaced when game object is exactly at the end of the waypoint

I went through FPS tutorial and it was working fine with some small problems.I have ragdoll which replaces the dead game object, it was working fine when the robot is moving within the waypoint. But when robot game object is exactly standing at the end of the waypoint and when i shoot it that time, the robot game object just dis appears and there is no rag doll too…

Below is the line of code to replace the robot with ragdoll…Please help …

function Detonate () {
// Destroy ourselves
Destroy(gameObject);

// Play a dying audio clip
if (dieSound)
	AudioSource.PlayClipAtPoint(dieSound, transform.position);

// Replace ourselves with the dead body
if (deadReplacement) {
	var dead : Transform = Instantiate(deadReplacement, transform.position, transform.rotation);
	
	// Copy position & rotation from the old hierarchy into the dead replacement
	CopyTransformsRecurse(transform, dead);
	score += 100;
	scoreGUI.text = score.ToString();
}

}

Code looks right. I would expect an error message in the console to explain your problem. Check it out.