[SOLVED] How to change the object variable multiple objects created by name

I thought I worked this out, but in my test, after creation 3, the object variable is no longer applied.

Here it is: I created 4 squares called Square1, Sqaure2 etc
I also made a text for each square to show their id variable value

I placed them in a group called Squares

I then when I press the make button, it creates an object from the group by name, using the IDnumber to get each square.

Then I ask to change that objects variable ID to the number in IDnumber.

Then a text box displays each square’s variable id value.

This how I was told it works, but results are unexpected:

When Sqaure1 is made and it’s id becomes 1
When Square2 is made it’s id becomes 2 but Square1’s text box id becomes zero
When Square3 is made all id values in the text boxes become zero
When Square4 is made all text boxes stay zero

So, I made a variable checker, and then the text boxes showed a value of 1 for square1, 2 for sqaure2, 0 for square3 and square4.

What I’m trying to do is create objects by a name, give them an id, so I can then move them and change them using this id. I thought it worked at first, but by creation 3, it fails to add the id and idk why.

1 Like

OMG realised what I did wrong, so stupid.

I forgot to put the others into the group.

Works now

Sigh.

2 Likes