pickup weapon after short delay?

I want to implement a pickup weapon system which isn’t too difficult, but i’m not sure how to go about inserting a short delay before the weapon is picked up so the player doesn’t accidentally swap weapons when running around. I thought about a yield WaitForSeconds but that just causes the player to still be able to accidentally pick up weapons but it just spawns in their hands after they walk away which isn’t exactly the effect I was going for. I did it with raycasting downward to see if there’s a pickup-able weapon and if their was it would SendMessage to show the GUI for the button to press to pick it up. Then if this was occuring I send another message when a button is pressed to initiate the pickupWeapon script in the weapon that is on the floor.

Here’s the code anyway, don’t think it’s too important to answering this, but it’s here for reference if anybody needs it anyway.

#pragma strict

var distance : float;

function Update () {
	
	var hit : RaycastHit;
	
	if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.down), hit)){
		distance = hit.distance;
		if (distance <= 1) {
			hit.transform.SendMessage("showGui", SendMessageOptions.DontRequireReceiver);
			if (Input.GetKeyDown(KeyCode.E))
			{
				hit.transform.SendMessage ("PickupWeapon", SendMessageOptions.DontRequireReceiver);
			}
		}
	}
}

Possibly add a timer, and then check again after the timer finishes?

 #pragma strict
 
 var distance : float;
 
 function Update () {
     
     var hit : RaycastHit;
     var pickupDelay = 1.0;	//The delay for picking up something

     if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.down), hit)){
         distance = hit.distance;
         if (distance <= 1) {
             hit.transform.SendMessage("showGui", SendMessageOptions.DontRequireReceiver);
             if (Input.GetKeyDown(KeyCode.E))
             {
                 yield WaitForSeconds(pickupDelay);
                 var dist = Vector3.Distance(transform.position, hit.transform.position);
                 if(dist <= 1){
                 	hit.transform.SendMessage ("PickupWeapon", SendMessageOptions.DontRequireReceiver);
             	 }
             }
         }
     }
 }