locking levels based on new game

Hey everyone! I have been working on this game for a while, and I have a script set up for level selection. So far, it works great, but I am running into one snag. I play the game and make it through a few levels. However, if I try to hit New Game, all of the levels I have played stay unlocked. Basically, the locks won’t reset and I don’t know how to fix it. Anyone have any ideas of what I can do to get this fixed?

public class LevelSelectManager : MonoBehaviour {

    public string[] levelTags;
    public GameObject[] locks;
    public bool[] levelUnlocked;
        
    public string[] levelName;
    
    private bool isPressed;

    public Button[] button;
        
    void Start()
    {
        GetComponent<Button>();

        for(int i = 0; i < levelTags.Length; i++)
        {
            if(PlayerPrefs.GetInt(levelTags*) == null)*

{
levelUnlocked = false;
button*.interactable = false;*
}
else if (PlayerPrefs.GetInt(levelTags*) == 0)*
{
levelUnlocked = false;
button*.interactable = false;*
}
else
{
levelUnlocked = true;
button*.interactable = true;*
}

if (levelUnlocked*)*
{
button*.interactable = true;*
locks*.SetActive(false);*
}

}

}

public void LoadScene(string levelName)
{
Application.LoadLevel(levelName);
}
}
And yes, if you are a newbie who is trying to figure this stuff out, you are more than welcome to use this script!

When you unlock your level, you need to save the changes to PlayerPref as well:

private void UnlockLevel(int index){
  levelUnlocked[index] = true;
  button[index].interactable = true;
  locks[index].SetActive(false);
  PlayerPrefs.SetInt(levelTags[index], 1);
}