Morph doesn't clone parts properly

So I managed to get a classic morph to sort of work, in that the morph part’s children aren’t cloning several studs off the player’s head, but I’ve run into yet another problem. The children seem to be cloning in different positions and orientations depending on what direction the player walks onto the morph. The beard (fifth of the head’s descendants), appears to the side of the player’s face, while the loincloth (first of the lower torso’s descendants), is often askew to the lower torso.
Here is the function that creates the beard:

function morphPlayerHead(part)
	local player = part.Parent:FindFirstChild("Humanoid")
	if player and player.Parent.Head.Transparency == 0 then
		local clone = head:Clone()
		local cloneWeld = Instance.new("WeldConstraint")
		local cloneChildren = clone:GetDescendants()
		print(cloneChildren)
		player.Parent.Head.Transparency = 1
		player.Parent["Pal Hair"]:Destroy()
		player.Parent.Head.face:Destroy()
		clone.Parent = player.Parent.Head
		clone.Anchored = false
		clone.Position = player.Parent.Head.Position
		clone.Orientation = player.Parent.Head.Orientation
		cloneChildren.Parent = clone
		cloneChildren[4].Position = clone.Position + Vector3.new(0, 0.309, 0)
		cloneChildren[4].Orientation = clone.Orientation + Vector3.new(0, -90, 0)
		cloneChildren[5].Position = clone.Position + Vector3.new(0, -0.51, -0.523)
		cloneChildren[5].Orientation = clone.Orientation + Vector3.new(0, -90, 0)
		cloneChildren.Anchored = false
		cloneChildren.CanCollide = false
		cloneWeld.Parent = clone
		cloneWeld.Part0 = clone
		cloneWeld.Part1 = player.Parent.Head
	end
end

And here is the function that creates the loincloth:

function morphPlayerHip(part)
	local player = part.Parent:FindFirstChild("Humanoid")
	if player and player.Parent.LowerTorso.Transparency == 0 then
		local clone = hip:Clone()
		local cloneWeld = Instance.new("WeldConstraint")
		local cloneChildren = clone:GetChildren()
		player.Parent.LowerTorso.Transparency = 1
		clone.Parent = player.Parent.LowerTorso
		clone.Anchored = false
		clone.Position = player.Parent.LowerTorso.Position
		clone.Orientation = player.Parent.LowerTorso.Orientation
		cloneChildren[1].Position = player.Parent.LowerTorso.Position + Vector3.new(0, -0.459, 0)
		cloneChildren.Anchored = false
		cloneChildren.CanCollide = false
		cloneChildren[1].Orientation = player.Parent.LowerTorso.Orientation + Vector3.new(0, 90, 0)
		cloneWeld.Parent = clone
		cloneWeld.Part0 = clone
		cloneWeld.Part1 = player.Parent.LowerTorso
	end
end
1 Like