How would make a monster for my game

Hi! I am currently working on a horror game in which you progress through generated rooms. There’s one problem. Adding monsters. I just don’t get how it would work because it would not just stay in a fixed position every time as the rooms are random. There are ones going up, sideways, etc… Could I have like a boss at a specific amount of rooms or something? Thanks for helping and here’s the room generation code if you need it.

room.random = Random.new()
local roomnumber = 1
function room.Generate(prevRoom)
	local possibleRooms = workspace.Rooms:GetChildren()
	local randomRoom = possibleRooms[room.random:NextInteger(1, #possibleRooms)]
	local newRoom = randomRoom:Clone()
	newRoom.Entrance.Transparency = 1
	newRoom.Exit.Transparency = 1
	newRoom.PrimaryPart = newRoom.Entrance
	newRoom:PivotTo(prevRoom.Exit.CFrame)
	newRoom.Parent = workspace.GeneratedRooms
	roomnumber = roomnumber + 1
	return newRoom
end

return room

When cloning a random room, you could also clone a random monster and set it’s position to somewhere in the room.
If the spawning position for each room is different, you could add an invisible part called something like “MonsterSpawn” in each room and set the monster’s position to that part’s position.

1 Like

Thanks for the help! I’ll try and implement that into the game! :slight_smile: