Help with meta tables

Hello developers,

This is my third post today, but I keep running into errors. I am very new to metatables / OOP in-general, so I may be completely wrong with how I am doing this script.

Module Script:

function MorphHandler:Weld(self, Character, CharacterBasePart, MorphEquipped)
	if MorphHandler then 
		
		local Shirt, Pants = self.Shirt, self.Pants

		Character.Shirt.ShirtTemplate = Shirt.ShirtTemplate 
		Character.Pants.PantsTemplate = Pants.PantsTemplate

		for _, BaseParts in ipairs(self:GetChildren()) do 
			if BaseParts:IsA("Model") then 
				for _, Bases in ipairs(BaseParts) do
					local ClonedBasePart = BaseParts:Clone()
					if Bases.Name == ClonedBasePart.Name then 
						print(CharacterBasePart.Name)
						ClonedBasePart.PrimaryPart.CFrame = CharacterBasePart.CFrame
						local Weld = Instance.new("Weld")
						Weld.Part0 = CharacterBasePart
						Weld.Part1 = ClonedBasePart.PrimaryPart
						ClonedBasePart.Parent = CharacterBasePart
						Weld.Parent = ClonedBasePart.PrimaryPart

						for _, PartsInBase in ipairs(ClonedBasePart:GetChildren()) do 
							PartsInBase.Anchored = false
						end
					end
				end
			end
		end
	end
end

Server Script:

MorphEquip.OnServerEvent:Connect(function(Player, MorphType)
	local Character = Player.Character or Player.Character:Wait()
	MorphEquipped = true
	
	local function CharacterBaseParts()
		local Table = {}
		for _, BaseParts in ipairs(Character:GetChildren()) do 
			if BaseParts:IsA("BasePart") then 
				table.insert(Table, BaseParts)		
			end
		end
		return Table
	end
	
	local BaseParts = CharacterBaseParts()
	
	MorphHandler:RemoveAccessorys(MorphType, Character, MorphEquipped)
	MorphHandler:Weld(MorphType, Character, BaseParts, MorphEquipped)
	
	if Character.Humanoid.Health == 0 then 
		MorphHandler:OnDeath(MorphEquipped)
	end
end)

I am getting the error:
https://gyazo.com/4a9fdf99779767e172a965fec190053d

Line 31:

for _, Bases in ipairs(BaseParts) do

Baseparts is a model because of the IsA function, that means you need to get children on the model or get descendants.

Also make sure the children are baseparts as well.

Okay, so that fixed the script. Now there is another error (even though the script works perfectly fine):

https://gyazo.com/ba9bbb9e3999f7448e8a8ba7fe2f5d3f

Line 34:

ClonedBasePart.PrimaryPart.CFrame = Bases.CFrame

You should print it out, if it’s saying it’s got an instance instead of a table somethings wrong like before

So when I print out:

print(ClonedBasePart.CFrame)

It gives me this:
https://gyazo.com/01933ec43e2a36dc681ab3e3ce51cdf2

There is a model inside your model, you will need to ignore it with a if statement and IsA check and avoid doing .CFrame or get descendants and find the parts inside this other model

Can you elaborate more on that? I kind of got lost.

Here is what it looks like:
https://gyazo.com/db445f47c79fa3382a2f3d73715854e4