How do I append an array to another array?

How do I…

I’m making the code as so to update two scene variables, called PosicaoX and PosicaoY, after the player clicks an objetc. I then insert both of the updated versions into a scene array variable “PosicaoNova”.
Then, I want to append the array “PosicaoNova” into the last scene variable “Caminho”, so that “Caminho” stores arrays of X and Y. How do I do it?

What is the expected result

As of right now, I’m only trying to set a text variable to the content of “Caminho” and see if it works, but it doesn’t seem so. The expected result would be to have the text change from “0” to whatever the new number is.

What is the actual result

Currently, what’s happening is that the text doesn’t change from “0”, but I don’t know if it is because I’m doing the appending/insert wrong, or I’m doing the attribution in the text wrong.

Related screenshots

This is where I’m doing the first attribution. Based on this, the text variable should change from “0” to “150” when I click the ambulance object in game, but it doesn’t.

I’m not sure what your goal is but if you want an array of the x and y values or anything else, you can create a temp variable structure and then add it to an array. You can then go through the list with a for each child using child as the variable with whatever the children name are.

this adds a sprite to the screen, puts it’s x,y in a variable and adds it to an array. When the button is pressed it cycles through the array and adds their values to a text object. I rounded the numbers just to make it easier to read. The 1st condition is just to prevent a point from being added when the button is clicked.

Try it: