CSG API requires at least one object to be linked to a DataModel?

I just got back from a 1 week break of developing

I’m a bit bored so I decided to remake the model tab using scripts, and after testing my union function I get this error saying ‘CSG API requires at least one object to be linked to a DataModel’ and from my understanding at least 1 object shouldn’t be in nil.


local module = require(game.ServerScriptService.UPStudio) local children = game.Workspace:GetChildren()
local parts = {} 
for i, v in ipairs(children) do 
	if v:IsA("BasePart") and v.Name == "Part" then 
		print("BasePart") --All parts exist, no errors here
		table.insert(parts, v) 
module.Union(parts) --This is where it starts

Union function:

function upgradedStudio.Union(parts : table)
	local clonedParts = {} --table of cloned parts
	for i, v in ipairs(parts) do --loops through parts in table
		local clone = v:Clone() --clones current part
		table.insert(clonedParts, clone) --insert clone to table defined above
	end --ends for loop
	local firstPart = clonedParts[1] --gets the first part in the table
	table.remove(clonedParts, 1) --removes it from the table
	local savedProperties = saveProperties(parts) --gets all the saved properties
	local union = firstPart:UnionAsync(clonedParts) --gets the result union
	for i, v in ipairs(parts) do --hides the original parts
		v.Transparency = 1
		v.CanCollide = false
		v.CanTouch = false
		v.Anchored = true
	local meta = {} --metatable
	meta._index = union --lorem ipsum
	local toReturn = {OriginalParts = parts, SavedProperties = savedProperties, Union = union} --table to return
	setmetatable(toReturn, meta) --sets metatable
	return toReturn --returns toReturn

Solved it, turns out the clone’s parent is nil at first. (Also the same with the union from UnionAsync)