Procedurally generated areas script only generates the 1st area

What I want to achieve: Each time any proximity prompt is activated, the script generates a new area. The cframe of the area is the cframe of the placeholders, which I have numbered. Each time a player activates the proximity prompt, the intvalue goes up by 1 and the textlabel updates to the intvalue’s number so the script knows what placeholder to put the area’s cframe as.

My Issue: Only the 1st area gets generated, the others don’t. In the developer console, it says "ServerScriptService.Generate:Line11: attempt to index nil with ‘CFrame’ "

---my script
local rooms = game.ReplicatedStorage:WaitForChild("GeneratedRooms"):GetChildren()
local textvalue = script.TextLabel.Text
local ProximityPromptService = game:GetService("ProximityPromptService")

ProximityPromptService.PromptTriggered:Connect(function()
	local placeHolder = game.Workspace.Placeholders:FindFirstChild("R"..textvalue)
	wait(2)
	script.RoomNo.Value += 1
	local chosenRoom = rooms[math.random(1,#rooms)]:Clone()
	chosenRoom.PrimaryPart = chosenRoom.Floor
	chosenRoom:SetPrimaryPartCFrame(placeHolder.CFrame)
	wait(0.05)
	placeHolder:Destroy()
	chosenRoom.Parent = game.Workspace
end)

If anyone could help me, it would be greatly appreciated.

It’s because the children you pick might be deleted.

New code:

--//Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ProximityPromptService = game:GetService("ProximityPromptService")

--//Variables
local GeneratedRooms = ReplicatedStorage:WaitForChild("GeneratedRooms")
local TextLabel = script.TextLabel

--//Functions
ProximityPromptService.PromptTriggered:Connect(function()
	local placeHolder = workspace.Placeholders:WaitForChild("R".. TextLabel.Text)
	
	task.wait(2)
	script.RoomNo.Value += 1
	
	local chosenRoom = GeneratedRooms:GetChildren()[Random.new():NextInteger(1, #GeneratedRooms:GetChildren())]:Clone()
	chosenRoom.PrimaryPart = chosenRoom.Floor
	chosenRoom:PivotTo(placeHolder.CFrame)
	
	task.wait(0.05)
	placeHolder:Destroy()
	
	chosenRoom.Parent = workspace
end)