How to stop player from interacting with all objects at once

I have made an interaction system for my game, relying primarily on two scripts, WorldInteraction and Interactable. When I start the game up and try to interact with an object or NPC, the game interacts with ALL the objects and NPCs in the scene. After that it works fine. I’ve been staring at this problem for a while and can’t find what’s wrong with my code.

WorldInteraction code:

    	UnityEngine.AI.NavMeshAgent  playerAgent;
    
    
    
    	void Awake(){
    		playerAgent = GetComponent<UnityEngine.AI.NavMeshAgent>();
    	}
    
    
    	void Update () {
    		if (Input.GetMouseButtonDown (0) && !UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject())
    			GetInteraction ();
    	}
    
    	void GetInteraction(){
    		Ray interactionRay = Camera.main.ScreenPointToRay (Input.mousePosition);
    		RaycastHit interactionInfo;
    
    		if(Physics.Raycast(interactionRay, out interactionInfo, Mathf.Infinity)){
    			GameObject interactedObject = interactionInfo.collider.gameObject;
    			if (interactedObject.tag == "Interactable Object") {
    				interactedObject.GetComponent<Interactable> ().MoveToInteraction (playerAgent);
    
    			} 
    
    			else {
    				playerAgent.stoppingDistance = 0f;
    				playerAgent.destination = interactionInfo.point;
    
    
    			}
    		}
    	}

Interactable code:

	[HideInInspector]
	public UnityEngine.AI.NavMeshAgent  playerAgent;
	private bool hasInteracted;



	public virtual void MoveToInteraction(UnityEngine.AI.NavMeshAgent playerAgent){
		hasInteracted = false;
		this.playerAgent = playerAgent;
		playerAgent.stoppingDistance = 2.0f;
		playerAgent.destination = transform.position;

	}

	void Update(){
		if(!hasInteracted && playerAgent != null && !playerAgent.pathPending){
			float distance = Vector3.Distance (playerAgent.destination, transform.position);
						
		
				if (playerAgent.remainingDistance < playerAgent.stoppingDistance) {
				
					Interact ();
					hasInteracted = true;
				}
				
		}
	}

	public virtual void Interact(){
		Debug.Log ("Interacting with base class.");
	}

Any help would be highly appreciated.

1st of all, add using UnityEngine.AI; at the top of the script to get rid of UnityEngine.AI.NavMeshAgent references. Your code doesn’t look clear by that.

At line 11 it should be playerAgent.destination = this.transform.position;

Are You tagging these objects in Unity?