Create object based on a Variable

Here I am again! First of all, sorry for so many questions, but I’m stuck again and I confess that variables are not my speciality.
The text returns me: color.1 / color.2 / color.3 or color.4 according the generated random action.
If in “Among objects…” I replace “sorteado” by “color.1”, it creates the “verde” object. Why that doesn’t happen if the variable “sorteado” is equal to “color.1”?

Because you can’t create color.1 like you try to do.
Use color[“1”]

Same as

Please search before asking :wink:
http://wiki.compilgames.net/doku.php/gdevelop5/all-features/variables#structure_variables

I’m sorry, but I read this several times before asking but didn’t understand!
Sometimes reading is not enough and you need a more accurate explanation.
Thanks so much!

Finally I’m almost there!
I created a random number that creates a random object based on it.
Created a child for each generated random number to avoid the same number is picked again, creating one object of each color (no repeat).
At first, the code didn’t work, so I added a text action (yellow rectangle) to display my variable.
and suddenly my code start working.
If I remove or disable the text action the code doesn’t work and it creates multiple objects of the same color.
My question is: What a simple text action has to do with the code? It’s just displaying a text.
gd