How would I apply morphs to a character?

The complete morphs all have the same anatomy as a regular R6 rig. I’m using mesh parts to overlay the relevant body part while being around the same size.

How I want it to work:

  • A mesh part will match a specific body part of an R6 character. Six mesh parts make up each morph, one for each body part.
  • The mesh parts will be CanCollide false so they don’t interfere with the player’s physics.
  • All accessories are deleted from the character, either when the skin is selected or when a new character is added.
  • Each mesh part moves exactly like its’ respective body part, without being directly controlled by scripts or reacting to player input.

What I am doing currently:

  • The mesh parts that make up each morph are stored in ServerStorage. I use a specific hierarchy for scripting purposes and ease of use.
  • The morphs are cloned and parented to the character when the morph is selected or when the character is added.
  • A server script uses RunService.Heartbeat to make each mesh part replicate the position and orientation of the respective body part every frame (again, the two are almost the same size).
  • Due to the slightly bigger size of the morph, it looks like it is doing everything the regular character does. The original body parts are still there, but they are not seen.

However, I have a feeling that there is a much better way to have the morph’s parts mimic body part movement than manually changing their position every frame. Is there a better way to achieve this?

TLDR: I want my 6-part morph, a mesh part for each equivalent body part, to overlay the character and copy it’s movement without it doing the work the actual body parts do.

You should attach each part to the corresponding character’s limb by using WeldConstraints. WeldConstraints, as the name implies, welds 2 parts together and makes it so both parts stay in the same relative position and orientation of each other.

Setting the morph part’s orientation to that of the limb and setting the WeldConstraint’s Part0 property to to limb and the Part1 property to the morph part that corresponds to the limb should attach the two parts together.

Example:

local Character, Morph

for i,v in pairs(Character) do 
	local MorphPart = Morph:FindFirstChild(v.Name)
	
	if MorphPart then -- If there's a corresponding part in the morph model
		local ClonedPart = MorphPart:Clone()
		ClonedPart.Parent = Character
		
		local WeldConstraint = Instance.new("WeldConstraint", Character)
		WeldConstraint.Part0 = v
		WeldConstraint.Part1 = ClonedPart
	end
end
1 Like