for loop not working correctly

I have a for loop that instantiates objects, that object has a script and I am giving that script an number.

My code looks like this:

void Update()

    GameObject[] Clones = GameObject.FindGameObjectsWithTag("clone");

    if (_UpgradesList.Count != UpgradesList.Count)


        foreach (Upgrades _upgrades in UpgradesList)

        foreach (GameObject Clone in Clones)

        for (int n = 4; n > -1; n--)
            Instantiate(UpgradeButton, ParentObject);
            UpgradeButton.tag = "clone";
            UpgradeButton.GetComponent<UpgradeScript>().InternalListItem = n;

(The for loop at the bottom is the one)

I put a Debug.Log in the loop, but when I look in the console it says 0, 4, 3, 2, 1 and not 4, 3, 2, 1, 0

Look at @Hellium 's comment about the order of your logs.

But you might also be using Instantiate incorrectly:

newObject = Instantiate(objectToCloneOrPrefab, ....)
newObject.tag = "clone";
newObject.GetComponent ....

What you’re doing is create a new object from a prefab and parent it, then lose (not store) a reference to that new object. Then you update the tag and a variable on a component. I assume this needs to be done of the new object.