Only make changes to one prefab instance

Ok so i have a car script on a car but when i drag another instance of it from the prefabs and get in the first car both move and ive looked into how to control one a time but no one seems to cover this issue and if you want ill post the code but it’s really long lol

Yes i do have a player with a player controller (i haven’t added turning yet )

First thing you’ll need to do is remove the isNear variable we created in the car script. Also, remove the trigger collider objects we created on the cars. You will not need them anymore.

Then, remove the following code from the car script.

if (Input.GetKeyDown("h") && isNear)
{
     if (inCar == true)
         inCar = false;
     else
         inCar = true;
}

Then add this code into the script that will controller your player. If you do not have a script on your player, create one. For example it could be called PlayerController. I believe you said you have a controller that moves forwards and backwards so far, so this should go into that script.

private bool interactRayActive = true; //Use this to turn on the entire ray system.  For example set this to false if the player is inside of the vehicle so that the ray is disabled while driving. (saves on resources).

private float interactLength = 5f;  //how far the ray will travel.
private bool lookingAtCar;

private GameObject playerHead; //The gameobject that will fire the ray.

private void Start()
{
    playerHead = GameObject.Find("PLAYER GAMEOBJECT NAME HERE");
}

private void Update()
{
    if (interactRayActive)
    {
        RaycastHit interactRayHitInfo;
        Ray interactRay = new Ray(playerHead.transform.position, playerHead.transform.forward);
        bool interactRayHit = Physics.Raycast(interactRay, out interactRayHitInfo, interactLength);

        //Remove the comments from this if statment if you want to see the name of the object being hit.
        //if (interactRayHit)
        //{
        //    Debug.Log(interactRayHitInfo.transform.name);
        //}

        //This checks to see if the ray hit something.  If true (yes it hit something) and that thing is on layer "Layer #" then do the following
        if (interactRayHit && interactRayHitInfo.transform.gameObject.layer == PUTLAYERNUMBERHERE) //Be sure to create and set your vehicles to a layer
        {
            if (interactRayHitInfo.transform.tag == "Vehicle") //tag the vehicles with this tag.
            {
                lookingAtCar = true;
            }
            if (interactRayHitInfo.transform.name != "Vehicle") // != means "NOT equal to"
            {
                lookingAtCar = false;
            }

        }
        else if (interactRayHit == false) //if the ray is not hitting anything this stuff will happen.
        {
            lookingAtCar = false;
        }

        //Now use lookingAtCar the same way we did your trigger.
        if (lookingAtCar && Input.GetKeyDown(KeyCode.H))
        {
            interactRayHitInfo.transform.GetComponent<CARSCRIPTNAMEHERE>().inCar = true;
        }
    }
}

Ok, cool. Let me know if you have trouble hooking this all up. Good luck buddy,