Room generation help? (Revised)

I am using a serverscript and two modulescripts to create a room generation system. I am trying to keep multiple rooms of the same type from spawning in a row along with other types of rooms. When I run I get this error.
image

Below are my scripts

Server

local room = require(script.Room)

local prevRoom = workspace.StartRoom


for i=1, 10 do
	prevRoom = room.Generate(prevRoom)
end

Module 1 (The one i’m getting the error from

local room = {}
room.info = require(script.RoomInfo)
room.LastTurnDirection = nil
room.random = Random.new()

function room.GetRandom(prevRoom)
	local possibleRooms = workspace.Rooms:GetChildren()
	local RandomRoom = possibleRooms[room.random:NextInteger(1, #possibleRooms)]
	
	local direction = room.info[RandomRoom.Name]["Direction"]
	local hasStairs = room.info[RandomRoom.Name]["Stairs"]
	local prevHadStairs = room.info[prevRoom.Name]["stairs"]
	
	if prevRoom.Name == RandomRoom.Name then
		return room.GetRandom(prevRoom)
	elseif direction and direction == RandomRoom.LastTurnDirection then
		return room.GetRandom(prevRoom)
	elseif hasStairs and prevHadStairs then
		return room.GetRandom(prevRoom)
	else
		if direction then
			room.LastTurnDirection = direction
		end
		return RandomRoom
	end
	
end

function room.Generate(PrevRoom)
	local RandomRoom = room.GetRandom(PrevRoom)
	local newRoom = RandomRoom:Clone()
	newRoom.PrimaryPart = newRoom.Enter
	newRoom:PivotTo(PrevRoom.Exit.CFrame)
	newRoom.Enter.Transparency = 1
	newRoom.Exit.Transparency = 1
	
	newRoom.Parent = workspace.GeneratedRooms
	
	return newRoom
	
end

return room

Module 2

local roomInfo = {
	["StartRoom"] = {
},
	["SmallRoom"] = {
		
	},
	["MediumRoom"] = {
		
	},
	["FirePlaceRoom1"] = {
		["Direction"] = "Left"
	}
	}
	

return roomInfo

You have to have a “Direction” property on every room in your roominfo module script- even if its value is just ‘false’. Only FirePlaceRoom1 has it, others will give an error. Same goes for stairs.

It seems to only give me that error when it’s trying to spawn the fireplace room but i’ll try this

Yeah this doesn’t seem to do anything to help

Or it could mean RandomRoom in the previous line is nil. Are you sure that part works? Try “print(RandomRoom.Name)” on the empty line- see if you get the name or an error.