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
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
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
Maybe run the :WaitForChild(“Folder”) in a seperate line, genuinely don’t know why that would happen. I heard chaining :WaitForChild()s aren’t that good anyway.