I have created this script for a game, it randomly moves rooms that I have created and placed in Replicated Storage (in a folder called GeneratedRooms), to placeholder floors in the workspace (in a folder called PlaceHolders). To create a tunnel of randomly generated rooms.
The Script:
local rooms = game.ReplicatedStorage:WaitForChild("GeneratedRooms"):GetChildren()
for I, placeHolder in pairs (game.Workspace.PlaceHolders:GetChildren()) do
local chosenRoom = rooms[math.random(1,#room)]:Clone()
chosenRoom.PrimaryPart = chosenRoom.Floor
chosenRoom:SetPrimaryPartCFrame(placeHolder.CFrame)
placeHolder:Destory()
chosenRoom.Parent = game.Workspace
end
I was wondering how I could make this script be able to reset its self every few minutes, so it has a new set of randomly generated rooms. Currently, I have to leave and rejoin the game to get a different set of rooms.
Thanks for your help!

1 comment
One thing you can do is have a folder in workspace called 'Rooms' or whatever youd like to name it, then parent the rooms to the folder instead of workspace. so when you want to reset the rooms, just delete everything in the folder, and repeat the process