Unwanted multiple instantiations with fast tap / touches. Why?

This script is keeping me up nights. If I quickly tap the object that the following script is attached to, it
will instantiate multiple objects. They seem to build exponentially with additional touches.
Anyone have any suggestions?

var deadReplacement : GameObject;
var deadReplacementPosition : Vector3;
var deadReplacementRotation : Quaternion;
var hit : RaycastHit;
var dieSound : AudioClip;
var damagesound : AudioClip;
var myTransform : Transform;

function Awake() {
   myTransform = transform; // this objects transform
}	
	function Update () {
		
	
		for (var event : iPhoneTouch in iPhoneInput.touches) {
		if(event.tapCount == 1  event.phase == iPhoneTouchPhase.Ended)
        var ray = camera.main.ScreenPointToRay(event.position);

                
         if (Physics.Raycast(ray, hit, 1000) ) {
            var hitObject : GameObject = hit.transform.gameObject;
            var hitTransform : Transform = hitObject.transform;
            if ( hitObject.tag == "TEST" ) {
               if ( myTransform.position.x == hitTransform.position.x) {       // matches x position
                  if ( myTransform.position.z == hitTransform.position.z) { 
                  	if ( myTransform.position.y == hitTransform.position.y) {  // matches z position
                     // so this is the object touched in the 2d space
                     deadReplacementPosition = hit.transform.position;
                     deadReplacementRotation = hit.transform.rotation;
                 

                 
                       Destroy( hit.collider.gameObject );
                     var parentTransform : Transform = hit.transform.parent.gameObject.transform;
             
                     // Play a dying audio clip
                     if (dieSound) {
                        AudioSource.PlayClipAtPoint(dieSound, transform.position);
                     }
                     
                         // Replace ourselves with a deadbody
                     if (deadReplacement) {
                        var dead : GameObject = Instantiate(deadReplacement, deadReplacementPosition, deadReplacementRotation);
                        dead.transform.parent = parentTransform;
                     }
                     
                     
               
                   
                }}}}}}}

still looking for a solution to this…

you’re probably instantiating the instantiated stuff so it’ll grow exponentially. Stick it on a separate script?

Thanks for the suggestion, Hippocoder.
I tried separate scripts, but strangely, I’m still getting these multiple instantiations.
Using the above code, I can touch my object an get the desired result - a newly instantiated child object.
Thing is, if I hit the object fast enough, multiple objects are instantiated.
I’m at my wits end.

Any other input would be helpful, thanks!

-G

Use Time.deltaTime to keep track of the last time something was instantiated and then compare it to a threshold you set for how quickly objects can be instantiated.

Remember Awake() will get called when you instantiate it.

Thanks for coming to my rescue guys! A combination of your suggestions showed me the light.
Hope I can return the favor some day.

Thanks,

Greg