GameObject wont correctly instantiate into an array

I’m trying to make a script for a chain, which spawns a certain amount of chain links based on a variable in the inspector. I can not figure out why my code will not instantiate more than one link. I have verified that my loop runs the correct number of times when I remove the instantiate line. Here is my code:

private void Start()
    {
        for (int numOfChainsToSpawn = 0; numOfChainsToSpawn != numOfChains; numOfChainsToSpawn++)
        {
            chains[numOfChainsToSpawn] = Instantiate(chainLink, transform.position, transform.rotation);
        }
    }

Every time I run the Project, it instantiates one link, then I get a nullReference exception. Any ideas on what could be causing this?

Well I see 2 problems. First of all the array needs to be created… At this point the array has no length so when you try to access the array[2], it doesn’t exist yet. Second of all you should use < not != in a for loop(kinda personal preference)

private void Start()
{
     chains = new "Whatever type chain is"[numOfChains];
     for (int i = 0; i < chains.Length; i++)
     {
          chains *= Instantiate(chainLink, transform.position, transform.rotation);*

}
}