I tried to make a randomly generated room script, and it was working wen i changed the position of a room without cloning it, but as soon as i started closing it it stopped working…
Please help!
local roomsfolder = game.Workspace:WaitForChild("Rooms")
local roomspawns = game.Workspace:WaitForChild("RoomSpawns")
local roomsfolderchildren = roomsfolder:GetChildren()
local randomroom = nil
for _, v in pairs(roomspawns:GetChildren()) do
v.Transparency = 1
randomroom = roomsfolderchildren[math.random(1, #roomsfolderchildren)]
local ClonedRoom = randomroom:Clone()
ClonedRoom.Position = v.Position
end
I made a baseplate with 4 “spawnpads” and 3 “random rooms”
the script gets a random room and then moved its CLONED version to the selected spawnpad.
it does this for every spawnpad.
it WAS working when i was just changing the rooms position, but now it wont for some reason after i added cloning the rooms.
i think i explained it wrong, here lemem try again
the script will get a possible spawn location for a room right?
so it gets a part that has the coordinates of where a room can spawn.
(we will call this the SpawnPad)
then it gets a random room tha can be spawned at those coordinates.
it goes through a folder and gets a random room
(we will call this the RandomRoom)
then im getting the RandomRoom and cloning it"
then im getting that cloned room and moving it to a possible SpawnPad’s location