I'm making a Character Customization script. Everything works fine and all except for the fact that the hair doesn't attach to the dummy character in the game properly.
I'm using the following code to attach the hair to the dummy: (Note. I'm using Accessories with Attachments in them)
--Local Script --Cloning the hair from ReplicatedStorage local new = hair:Clone() --Finding and destroying the old hair for _, part in pairs(Dummy:GetChildren()) do if part.Name == 'HairA' then part:Destroy() end end new.Name = 'HairA' --Parenting the hair to the Dummy new.Parent = Dummy
This code works fine in Solo Play but breaks whenever I try it in a server test it seems to break. The hair also has the proper HairAttachment in it's handle. There aren't any errors in the output either.
Gif of the Issue: https://i.imgur.com/j7YB6V9.gifv
Is it because it's in a local script? If so why?
Edit: Should probably also mention that the dummy I'm using to show off the character is a local part inside a camera.
Edit: Ok so it turns out it was because the dummy was inside a camera it was breaking so I've placed it in the workspace and it works fine. If you know how to get it working with local parts that would be great though. For now I'll just set the place to 1 player.
Thanks for the help, Rayinator.
Try setting the position
--Local Script --Cloning the hair from ReplicatedStorage local new = hair:Clone() --Finding and destroying the old hair for _, part in pairs(Dummy:GetChildren()) do if part.Name == 'HairA' then part:Destroy() end end new.Name = 'HairA' --Parenting the hair to the Dummy new.Parent = Dummy new.Position = Vector3.new(0, 0, 0) -- Change this to the position you need