Delay when creating/destroying local objects inside character while using layered clothing

Reproduction Steps

Make sure layered clothing is enabled, wear a piece of layered clothing, create a localscript in starterplayerscripts with this code:

task.wait(2)

while true do
	local partA = Instance.new("Part")
	partA.Size = Vector3.new(2, 2, 2)
	partA.Shape = Enum.PartType.Ball
	partA.Anchored = true
	partA.Color = Color3.new(1, 0, 0)
	partA.CFrame = CFrame.new(2, 4, 0)
	partA.Parent = game.Players.LocalPlayer.Character

	local partB = partA:Clone()
	partB.Color = Color3.new(0, 1, 0)
	partB.CFrame = CFrame.new(-2, 4, 0)
	partB.Parent = workspace
	
	task.wait(1)
	
	partA:Destroy()
	partB:Destroy()
	
	task.wait(1)
end

Expected Behavior

The red part (parented to character) and green part (parented to workspace) should both appear and disappear at the same time



Actual Behavior

There is a noticeable delay when the red part (parented to character) is created and destroyed



Workaround

Parenting character-related objects to workspace

Issue Area: Engine
Issue Type: Other
Impact: Moderate
Frequency: Constantly

6 Likes

Adding Parts or Welds into a character’s Model hierarchy can cause a delay when using layered clothing, as you observed. If possible, keep Parts and Welds outside the character’s Model to avoid this. For example, add a folder above the character Model to organize rigid accessories and their welds. We are also working on other optimizations that should improve performance in the cases where parenting into the Model can’t be avoided.

1 Like

Is there a way to wait for this delay to finish?

For now, the only thing you can do is avoid triggering the rebuild, but we are also working to optimize this on our end.

4 Likes