Is there the most efficient way to make the room generation?

So, let me explain, when the game runs, I want to make it so It generates every room and hallways individually, like the way SCP:CB does it.

But, I’m not sure where to begin with. My brain just gave up on thinking, at this moment.

I need any examples that might help me.

Before I generate any rooms, should I use For X = 1, MapWidth, For Z = 1, MapHeight ?

Or, should I use something else instead?

And, aside from that, how do I get every hallways to connect to each other, without overlapping? Some of them has 2 doorways, others has more or less than that.

I would assume they use a node map with and place each model from a module script to replace the node with the model. Here is an example I found previously that uses a similar method that is uncopylocked: 🔓 CVRF Development Branch 🔓 - Roblox

With this, you could check out this post: How could I make an infinite room generator? which goes through infinite generation or Randomly Generated Rooms for randomly generated rooms. And you could mix them together to allow you to create what you’re looking for; for example, an infinite generation of rooms with a random assortment of models within, or to that extent using the node mapping.

I don’t understand anything in that uncopylocked place.

And, I’ll give these links a try later. I will let you know when I need help.