Doors type game help

trying to make a game that is similar to doors using GnomeCodes doors tutorial videos for the base and i have randomly generating rooms but i want to make it so i can have a specific room at a specific door. like how door 50 is the library boss in the game. how would i go about doing that? I’m a pretty beginner scripter so details are very appreciated

1 Like

So what you want to do is sent number of cycle to room generator function.

Instead of using random function every time, you check if it is not count == 50 for example;

Your function gonna look like this

function room.Generate(prevRoom, count)
	local newroom
	if count == "Insert your number here" then
		newroom = "Your numbered room model"
	else
		local RandomRoom = room.GetRandom(prevRoom)
		newroom = RandomRoom.Clone()
	end
	-- Your room placer script should be here
end

Possibly you should also make a room before your numbered to avoid some of collisions between big and curved rooms

ive put the code into my script but there is an error.

It states “Module code did not return exactly one value”

here is my script where i put the code in the room script
Screenshot 2024-09-20 185100

and here is the error in the server script
image_2024-09-20_185231976

any idea what the problem is?

1 Like
  1. when you are using a function, you need to send as much values as you stated
    so you should use a prevRoom = room.Generate(prevRoom, i)

i is number of your cycle, check “for” cycles documentation.

  1. also " " states for string, so you can’t compare it to an int value put just 5 instead of “5”, same thing for “Room5”, use an way to room model like workspace.GeneratedRooms.Room5

have a value that counts up everytime a new room is generated. if the value is 48 the next room (49) will have the room with the library door (or any door you’d like) and if the value is 49 the next room (50) will be the figure library room or whatever you want. thought i would appreciate it if you showed me the code

ive fixed the room script but the server script still says that it hasnt returned exactly one value?

its in the server script
image_2024-09-22_103639841

add an i to script so it should look like this
prevRoom = room.Generate(prevRoom, i)
i states for “for” count

the module is still not returning exactly one value.

the only code with a red line is the "local room = require(script.Room)

idk whats causing that its been going on since i put the room 5 code into the room script.

I just ignored the screenshots you’ve attached
You should not just copy and paste code i sent, it was to replace your code
image
What does the red part even mean?
So error is caused by false syntax and function being inside another

also delete “end” after return room