Is there a way to wrap layered clothing locally?

I’m trying to make an avatar config system, and I’m cloning the preview avatar locally into the workspace. Everything works fine until I try and clone a layered clothing from replicatedstorage and parent it to the cloned preview avatar in workspace. The clothing clones but it doesn’t wrap around the preview character like it should and just hangs around at 0,0,0

Is there a way I can solve this with the layered clothing being wrapped around the avatar locally?

function Initialize()
	print("yes")
	for i,v in pairs(ReplicatedStorage:FindFirstChild(Whichbuttonison):GetChildren()) do
		if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("Accessory") then

			local clone=temp:Clone()
			
			clone.Parent=AccessoryScroll
			clone.Name=v.Name
			clone.Text=v.Name
			clone.Active=true
			clone.Visible=true
			clone.MouseButton1Down:Connect(function()
				local characterModel=CloneFolder:FindFirstChildOfClass("Model")
				if characterModel and not characterModel:FindFirstChild(v.Name) then
					local head=characterModel:FindFirstChild("Head")
					
					if head then
						if Whichbuttonison=="Hat" or  Whichbuttonison=="Hair" then
							local clone=ReplicatedStorage:FindFirstChild(Whichbuttonison):FindFirstChild(v.Name):Clone()
							clone.Parent=characterModel

							local weld=Instance.new("WeldConstraint")
							weld.Name="AccessoryWeld"
							weld.Part0=head
							weld.Part1=clone
							weld.Parent=head


							clone.Position = head.Position

							table.insert(AccessoryTable, clone)
							print("Accessory added locally.")
						else
							local clone=ReplicatedStorage:FindFirstChild(Whichbuttonison):FindFirstChild(v.Name):Clone()
							clone.Parent=characterModel--nope doesnt work
							table.insert(AccessoryTable, clone)
						end
					end
				end
			end)
		end
	end
end
1 Like

Have you attempted placing the layered clothing on the server? Not that you should do that, just to rule out that it’s an issue strictly on the client.

Yeah I used a test script in serverscriptservice that cloned the character from replicated storage into the workspace, and cloned the layered clothing also from repstorage into that cloned character and it works fine

it’s a client issue

This post solves your issue.

You just have to preload the layered clothing first. (As far as I’m aware, if there’s an issue with this solution please tell me.)

I ran this code and it seemed to work.

--!strict

-- Services
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local ContentProvider = game:GetService('ContentProvider')

-- Constants
local LayeredClothing = ReplicatedStorage.FBXImportGeneric :: Accessory

local Rig = workspace.Rig :: Model

-- Main

local MyClothes = LayeredClothing:Clone() :: Accessory

ContentProvider:PreloadAsync({MyClothes})

MyClothes.Parent = Rig
1 Like

do the clothes have to be parented to a clone in repstorage for it to work? It doesn’t seem to be working and the clothes don’t calculate the wrap and hang out at 0,0,0 still.


I have to manually move it and it doesn’t wanna wrap.

(the layered clothing are stored under a folder in repstorage)

function Initialize()
	print("sne")
	for i,v in pairs(ReplicatedStorage:FindFirstChild(Whichbuttonison):GetChildren()) do
		if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("Accessory") then

			local clone=temp:Clone()
			
			clone.Parent=AccessoryScroll
			clone.Name=v.Name
			clone.Text=v.Name
			clone.Active=true
			clone.Visible=true
			clone.MouseButton1Down:Connect(function()
				local characterModel=CloneFolder:FindFirstChildOfClass("Model")
				if characterModel and not characterModel:FindFirstChild(v.Name) then
					local head=characterModel:FindFirstChild("Head")
					
					if head then
						if Whichbuttonison=="Hat" or  Whichbuttonison=="Hair" then
							local clone=ReplicatedStorage:FindFirstChild(Whichbuttonison):FindFirstChild(v.Name):Clone()
							clone.Parent=characterModel

							local weld=Instance.new("WeldConstraint")
							weld.Name="AccessoryWeld"
							weld.Part0=head
							weld.Part1=clone
							weld.Parent=head


							clone.Position = head.Position

							table.insert(AccessoryTable, clone)
							print("Accessory added locally.")
						else
						
							

							
						--	local LayeredClothing = ReplicatedStorage:FindFirstChild(Whichbuttonison):FindFirstChild(v.Name):: Accessory

							local Rig = characterModel :: Model

							-- Main
							local clone=ReplicatedStorage:FindFirstChild(Whichbuttonison):FindFirstChild(v.Name)
							local MyClothes = clone:Clone() :: Accessory

							ContentProvider:PreloadAsync({MyClothes})

							MyClothes.Parent = Rig
							table.insert(AccessoryTable, clone)
						end
					end
				end
			end)
		end
	end
end
1 Like

Is the rig your using an rthro rig?

1 Like

it’s the skinned rig you find in the avatar tab>rig builder>skinned rig r15

1 Like

Okay, i’ll recreate your situation real quick.

2 Likes

Screenshot 2025-03-03 215754
These are my results when running this code,

--!strict

-- Services
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local ContentProvider = game:GetService('ContentProvider')

-- Constants

local Mannequin = workspace:WaitForChild("Mannequin") :: Model

local Pants = ReplicatedStorage.Pants :: Accessory

-- Main

local MyPants = Pants:Clone() :: Accessory

ContentProvider:PreloadAsync({MyPants})

Pants.Parent = Mannequin

is this a localscript?

chars chars

1 Like

Yes, it’s a local script in the StarterGui.

2 Likes

Screenshot 2025-03-03 220342
Not sure why its not working for you, because I’m also able to load in other layers on top of each other. Can I maybe find the exact rig you’re using?

1 Like

The pants in mine are in a folder in replicated storage.

--!strict

-- Services
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local ContentProvider = game:GetService('ContentProvider')

-- Constants

local Mannequin = workspace:WaitForChild("Mannequin") :: Model

local Pants = ReplicatedStorage:WaitForChild("Folder"):WaitForChild("Pants") :: Accessory

-- Main

local MyPants = Pants:Clone() :: Accessory

ContentProvider:PreloadAsync({MyPants})

Pants.Parent = Mannequin


without “WaitForChild(“Folder”)” it works, but with it it doesn’t work? wth

both exist in replicatedstorage

1 Like

Maybe run the :WaitForChild(“Folder”) in a seperate line, genuinely don’t know why that would happen. :man_shrugging: I heard chaining :WaitForChild()s aren’t that good anyway.

2 Likes

I messed around a bit and now it works! Thanks!

I just needed to parent the mannequin back into repstorage for the client to properly wrap the clothing.

local Mannequin = characterModel :: Model
							Mannequin.Parent=ReplicatedStorage
							local Pants = ReplicatedStorage:FindFirstChild(Whichbuttonison):FindFirstChild(v.Name) :: Accessory

							-- Main

							local MyPants = Pants:Clone() :: Accessory
							MyPants.Parent=ReplicatedStorage
							ContentProvider:PreloadAsync({MyPants})

							MyPants.Parent = Mannequin
							Mannequin.Parent=CloneFolder
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.