Simple Room Generation System Malfunctions Specifically

  1. What do you want to achieve? Keep it simple and clear!

I’m following this simple room generation guide:

https://www.youtube.com/watch?v=z0g5sLZapqI

  1. What is the issue? Include screenshots / videos if possible!

The generation works smoothly with the yellow room, until it tries generating the red room in the video shown below.
For some reason, it generates the OPPOSITE way. This might be with the pivoting. Im really confused to why it’s reversing.
Everything else works well, until it tries generating the red room.
Another important thing worth telling:

When I move the PrimaryPart of the red room (its entrance which is the part sticking out) to the exit of the previous room, its reversed. But for the yellow room, it works fine.

Video:
robloxapp-20250105-1719425.wmv (645.6 KB)

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Module Script:

local room = {}
local possibleRooms = game.ReplicatedStorage.Rooms:GetChildren()



room.Generate = function(prevRoom)
	
	local pickedRoom = possibleRooms[math.random(1,#possibleRooms)] -- Pick a room model.
	
	local NewRoom = pickedRoom:Clone()
	
	NewRoom.PrimaryPart = NewRoom.Entrance -- Set it's primary part.
	
	NewRoom:PivotTo(prevRoom.Exit.CFrame) -- Move to the previous room's exit cframe.
	print("Moved")
	
	NewRoom.Parent = workspace.GeneratedRooms --S.E
	
	return NewRoom -- return it so  we can use it as a var for prevRoom

	
end




return room

Server:

local GenerateRoomModule = require(game.ReplicatedStorage.GenerateRoomModule)


local prevRoom = workspace.StartRoom
local x = 1


	repeat
		x += 1
	prevRoom = GenerateRoomModule.Generate(prevRoom)
	task.wait(1)
	until x == 10
  • Copy the Yellow Room:

    • Duplicate the yellow room and rename it to “Red Room” (or whatever your red room is).
  • Check Generation with the change:

    • Before running the generation, make the new red look a little different from the yellow to easily tell if it’s generating.
  • See what the problem is

    • If it generates fine, the problem is likely in the model, because the yellow one worked.
    • If not, then the issue is likely in the script.

I say this because, in your video, it looks like the rooms generate fine excluding the red.

Seems like the same has been done with other rooms. Weird thing indeed

Is it happening on a specific iteration?

No, some rooms do that for some reason. Some work and some are reversed