Check if a build is touching the baseplate, or if another build is touching a build that is touching the baseplate?

Here’s a new script I made for you.

You’ll have to create an invisible hitbox for the part though which you add to the folder/group.

Here is the code:

local builds = game.Workspace.Builds

local function GetTouchingParts(part)
   local connection = part.Touched:Connect(function() end)
   local results = part:GetTouchingParts()
   connection:Disconnect()
   return results
end

local function check(folder)
	
	local list = {}
	
	for _,v in pairs(folder:GetChildren()) do
		
		local base = false
		
		local parts1 = GetTouchingParts(v)
		
		for _,a in pairs(parts1) do
			
			if a.Name == "Baseplate" then
				
				base = true
				
			else
				
				local parts2 = GetTouchingParts(a)
				
				for _,b in pairs(parts2) do
					
					if b.Name == "Baseplate" then
						
						base = true
						
					end
					
				end
				
			end
			
		end
		
		if not base then 
			
			table.insert(list,v)
			
		end
				
	end
	
	return list
		
end

while wait(.1) do
	
	local result = check(builds)
	
	if #result>0 then
		
		for _,part in pairs(result) do
			
			part:Destroy()
				
		end
		
	end
	
end

Here is the post from where I got the GetTouchingParts function from: (it only finds parts that are within the part, not touching the edge)