Need help on adding Accessories or Hats to a Dummy (r15) via script

I am trying to have it to where I can clone a hat, it appears on the right position (on its head for example as it should be), but so far when I clone a hat or accessory using addaccessory, it exists but its off to the side and not in the correct position, I’ve tried other methods, nothing has worked (like cloning/parenting to dummy without addaccessory but it did not work at all, addaccessory is the only one with an existing item).

BodyClone.Humanoid:AddAccessory(ReplicatedStorage.HatFolder.Fedora:Clone())
BodyClone.Humanoid:AddAccessory(ReplicatedStorage.HatFolder["NV Goggles 4X"]:Clone())

Done in local script

1 Like

Need more information. Please take a screenshot of your accessories with details enabled to show the position and rotation of the attachments. Additionally judging from the screenshot are you using a character in a ViewportFrame? Consider attaching everything you need before placing the character into the viewport or manually adjusting the CFrame.

2 Likes

I solved it, so basically to anyone wondering, you’ll want to before hand obtain origin pos and orientation–before even starting up a test run so simply put a hat onto a dummy, then get the vector3 values of:

paint2

Once you have the values on hand remove the hat and then in the script when you add accessory, set the pos and orientation to the values you obtained and voila:

paint1

This is being done for a customization system so simply doing it before hand entirely would be terrible (but I know you didn’t know)

This’ll be annoying to do but It is very well possible, just time consuming to implement, where I’ll have to check what item it is and set the origin to what it needs to be.

EDIT: The above didn’t work for some reason later on, instead you’ll want to set the cframe of the hat == to the head (chest if a chest accessory idk i need to test it) and then increment the vector3 values of x y z for the hat’s handle, increase or decrease if necessary (typically the y axis)

Just tested, you’ll want to experiment yourself, but set cframe to upper torso for chest hats.

This is annoying but it is the only alternative I can see.

1 Like