[Solved] How do I spawn a random object out of a group?

Hello, I’m trying to make an endless runner and no matter what I do I can’t seem to get a random object out of a group to spawn, it always just spawns Obstacle1 over and over and no others.


This is the code I have been using for this, it is from this forum post, my obstacles are called Obstacle1, Obstacle2, and Obstacle3. I have tried using arrays, using the solution from this same forum post and this tutorial. Any help would be greatly appreciated!

Did you add all of them to Obstacles group?
Double check cause your expression looks ok

1 Like

Just double checked my code, I forgot to make the movement code affect the object group instead of just one of the objects. The others were spawning, just not moving onto the screen :man_facepalming:

i cant edit the title for some reason, not sure why, but its solved now

2 Likes