Cant make a tile only spawn once when generating

I wanted to make a tile generated labyrinth but for some reason the exit and the spawn that i only want to generate once are generating multiple times

How can i fix that?

here’s the script

local Placeholders = game.Workspace.PlaceHolders
local rooms = game:GetService("ReplicatedStorage"):WaitForChild("Setpieces"):GetChildren()
local HasSpawn = false
local HasExit = false
task.wait(5)
for i, placeHolder in pairs(Placeholders:GetChildren()) do
	local chosenroom = rooms[math.random(1,#rooms)]:Clone()
	if chosenroom.Name == "Spawn" then -- Spawn
		if HasSpawn == false then
			HasSpawn = true
			chosenroom.PrimaryPart = chosenroom:WaitForChild("Carpet")
			chosenroom:SetPrimaryPartCFrame(placeHolder.CFrame)
		else
			chosenroom:Destroy()
			repeat 	
				chosenroom = rooms[math.random(1,#rooms)]:Clone()
				if chosenroom.Name == "Spawn" then
					chosenroom:Destroy()
				end
			until chosenroom.Name ~= "Spawn"
			chosenroom.PrimaryPart = chosenroom:WaitForChild("Carpet")
			chosenroom:SetPrimaryPartCFrame(placeHolder.CFrame)
		end
		print("Spawn set")
	elseif chosenroom.Name == "Exit" then -- Exit
		if HasExit == false then
			HasExit = true
			chosenroom.PrimaryPart = chosenroom:WaitForChild("Carpet")
			chosenroom:SetPrimaryPartCFrame(placeHolder.CFrame)
		else
			chosenroom:Destroy()
			repeat 	
				chosenroom = rooms[math.random(1,#rooms)]:Clone()
				if chosenroom.Name == "Exit" then
					chosenroom:Destroy()
				end
			until chosenroom.Name ~= "Exit"
			chosenroom.PrimaryPart = chosenroom:WaitForChild("Carpet")
			chosenroom:SetPrimaryPartCFrame(placeHolder.CFrame)
		end
		print("Exit set")
	else -- Normal room
		chosenroom.PrimaryPart = chosenroom:WaitForChild("Carpet")
		chosenroom:SetPrimaryPartCFrame(placeHolder.CFrame)
		print("Setpiece set")

	end




	placeHolder:Destroy()
	chosenroom.Parent = workspace -- Error here
end