Issue with inventory, unlocking one item unlocks them all

Hey guys i have a code in which a player can buy cars if he has money. All cars are locked at first but if i buy just one car all cars are unlocked .plz some one help me

public GameObject unlock;
public GameObject unlockPanel;
public static int boughtcars;

void Start()
{
    //PlayerPrefs.SetInt("boughtcars", boughtcars);
    //PlayerPrefs.Save();
    unlock.SetActive(false);
}

void Update()
{
    if (PlayerPrefs.HasKey("boughtcars"))
    {
        unlock.SetActive(true);
        unlockPanel.SetActive(false);
    }
}

private void OnTriggerStay(Collider other)
{
    if (other.gameObject.tag == "Human" && PlayerPrefs.GetInt("Coins") >= 1500)
    {
        unlockPanel.SetActive(true);
    }
    else if (PlayerPrefs.GetInt("Coins") < 1500)
    {
        unlock.SetActive(false);
        unlockPanel.SetActive(true);
    }
}

private void OnTriggerExit(Collider other)
{
    if (other.gameObject.tag == "Human")
    {
        unlock.SetActive(false);
        unlockPanel.SetActive(false);
    }
}

 void Buy2()
{
    if (PlayerPrefs.GetInt("Coins") > 1500)
    {
        //Buy the item
        PlayerPrefs.SetInt("Coins", PlayerPrefs.GetInt("Coins") - 1500);
        PlayerPrefs.Save();

        unlock.SetActive(true);

        PlayerPrefs.SetInt("boughtcars", boughtcars);
        PlayerPrefs.Save();
    }
}

can you plz help me and write code for this…
and write or set playerprefs…
i have 10 cars 9 cars are unlock and if i have coins then i can buy car and save in playerpref

Just from the provided info your setup is hard to see through.

I assume the problem is in the Update function. You don’t check for the value of “boughtcars”, you just check whether its there or not. Therefore as soon as you set it for one of the cars it is there and unlock.SetActive(true) is performed for all of the cars.

If this isn’t the problem please provide more information about your setup.