How to edit an instance variable of only a single instance that is created during runtime?

I’m using the Zombie Tower Defense Game template as a base right now and I’m working on an upgrade system. I want the user to be able to upgrade each of their towers, with the upgrade only affecting the instance that they paid to upgrade. I think I’ve found that the issue lies in the instance variable I was using to identify each tower. I want each tower to have a number, the first tower being 1, the second tower being 2, and so on. However, after the first instance, the value for the most recent instance seems to overwrite all of the previous ones.




Sorry if this is a dumb question, I’m new to both GDevelop and coding for the most part. I tried looking at the tutorial on object picking but it didn’t seem to cover instances created during runtime, and the other question I found about that didn’t seem to cover creating multiple instances with different variable values.

Yeah it is very dumb and stupid
And i know it is cause we all did exactly same mistake
Now you will feel what we all felt
You are not checking current value of variable and then adding 1 to it
You are just adding 1 to it each time where it always starts from same value which is 0
You need another variable to keep track how many times you already added 1

Now you even see in what order i placed them on map