Terrain Generation Failing(?)

Good morning, afternoon or evening!

Recently I’ve been rewriting a major system for one of my games, and all of it was working up until it came for terrain generation. It loops through the descendants, but no terrain appears whatsoever. The strange thing is, there are no errors that usually indicate what is wrong, the only errors are because I haven’t added a check to see if the Instance is a Part and not a Value.

	mapClone = this.selectedMap:Clone()
	mapClone.Parent = game.Workspace
	mapClone.Name = "Loaded_Map"
	--Do some special trickery to use terrain generation
	for _,x in pairs(mapClone:GetDescendants()) do
		s,e = pcall(function()
			if x.Anchored == true and x.Transparency == 0 and not mapClone.Name == "PaperHouse" then
				tr = game.Workspace.Terrain
				m = x.Material
				if m == Enum.Material.Sand and x.BrickColor == BrickColor.new(18,238,212) then
					m = Enum.Material.Water
				elseif m == Enum.Material.Glass then
					m = Enum.Material.Air
				x.Transparency = 0
				x.CanCollide = false

Any help would be greatly appreciated (i’ve checked the wiki, and read through it again and again, and none of my solutions seem to work)

There is an element in workspace also called “Terrain”, maybe change the folder name to something else?

I am using the Terrain element - not a folder
(Using syntax from Terrain Editor | Documentation - Roblox Creator Hub)

I reccommend generating the terrain with parts and THEN converting them into terrain

Parts are being generated first, then the terrain, the generation of parts succeed but terrain fails silently