I am currently building an obby game where in each round, random generated floors will be spawned. I am basing my work in this tutorial https://www.youtube.com/watch?v=_IbCnucSWjU , I think I made an error somewhere but I couldn't figure it out.

This is the script I used to randomly generate rooms (but failed to initiate)

local rooms = game.ReplicatedStorage:WaitForChild("GeneratedRooms"):GetChildren()

for i, placeHolder in pairs(game.Workspace.PlaceHolders:GetChildren()) do
	local chosenRoom = rooms[math.random(1,#rooms?)]:Clone()
	chosenRoom.PrimaryPart = chosenRoom.Floor
	chosenRoom:SetPrimaryPartCFrame(placeHolder.CFrame)

	placeHolder:Destroy()
	chosenRoom.Parent = game.Workspace
end

I am very confused (sorry I just started scripting)