Prevent getting the same object in table twice in a row

I tried to make an OOP obby generation script which worked as expected in terms of generating. But I encountered an issue when trying to prevent it from picking the same Obby piece twice in a row. I created a repeat loop in order to choose a random obby piece until the chosen piece wasnt equal to the last. But its just not working. Any ideas?

Images:

Beige parts spawned back to back
image_2024-01-10_152118950

Generating and using repeat loop

Project structure for reference
image_2024-01-10_152358111
image_2024-01-10_152449961

You are comparing a cloned instance to an original, which will never be the same thing. You will need to compare something else, like an ID or name of the stage in order to see if they are the same.

1 Like

Ah, you’re right! Can’t believe I made that oversight, but that’s why we have the forum. Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.