Hi there, I’ve been trying to make a main menu for my game and in it put a copy of player’s character for display. I managed to make it display shirts, colors and face but I can’t seem to get it to show accessories. I tried using the humanoid:AddAccessory() function and also simply parenting it but in both cases the accessory was parented to the dummy but wasn’t visible.
I searched for a solution and best I could find is just welding it. However, I’d like to know if there is any simplier way to do that?
local dummy = background.CharacterDisplay
dummy.Humanoid:LoadAnimation(dummy:WaitForChild("Animation")):Play()
local character = player.Character or player.CharacterAdded:Wait()
local clonedClasses = {"BodyColors", "Shirt", "Pants", "ShirtGraphic", "Hat", "Accessory"}
function ProcessChild(child)
if table.find(clonedClasses, child.ClassName) then
local new = child:Clone()
if child.ClassName == "Accessory" then
dummy.Humanoid:AddAccessory(new)
else
new.Parent = dummy
end
end
end
for i,v in pairs(character:GetChildren()) do
ProcessChild(v)
end
character.ChildAdded:Connect(ProcessChild)
-- Adding face
local face = character:WaitForChild("Head"):FindFirstChildOfClass("Decal")
if face then
local new = face:Clone()
new.Parent = dummy.Head
end```
Instead of cloning the players character, I would find it easier to have a blank dummy and apply all of the players accessories and clothes onto that dummy. You can get the players accessories easily using Players:GetCharacterAppearanceAsync(). Here is a link to the DevHub page for GetCharacterAppearanceAsync()
I’ve made a quick example script to demonstrate how I would do this, I have also provided a video of me using the studio command bar to run the script to demonstrate me putting my accessories and clothes onto a blank dummy.
Example Code:
local Players = game:GetService("Players")
-- Getting the UserId's appearance model
-- Testing using my UserId (you'd put the players here)
local Appearance = Players:GetCharacterAppearanceAsync(72822618)
-- Moving all of the objects in the appearance model to our empty dummy
local dummy = workspace.DevforumDummy
for k,v in ipairs(Appearance:GetChildren()) do
local alreadyExists = dummy:FindFirstChild(v.Name, true)
if alreadyExists then -- good for automatically parenting stuff like 'face'
v.Parent = alreadyExists.Parent
alreadyExists:Destroy()
continue
end
v.Parent = dummy
end
The problem is that accessories don’t get visible when I put them into the dummy. I see your script does the same thing except gets the accessory from a different source. Are you sure this would help?
Yes because you no longer have to use Humanoid:AddAccessory, and you aren’t cloning from the players character. It only returns the clothes, shirts, accessories and body colour for the player.
Acu, check the dummy model and make sure it has accessories like HairAccessory in the Head to pair with the HairAccessory in Hairs Accessories that you’re trying to add onto the dummy
you could get a copy of someone’s character model and pretty much copy and paste all the attachment accessories into the dummy
I don’t see how Archivable would help here. The accessories are cloned and parented properly, they just aren’t visible.
And no, there’s no errors. Everything gets put on the dummy properly except the accessories.
EDIT: I found something - the accessory is visible but for some reason it’s attached to the player character instead of dummy. I’ll see what I can do about this.