Stick accessories to rotating dummy

Hi,
I made a gui for changing clothes/accessories. I also made a dummy that spins around to show selected clothing/accessories. It works great with clothing, but not so much with accessories. I get the accessories from roblox catalog and put them on another dummy to get the right position for it when put on dummy in the gui. The problem is the rotation of the accessory, what I do is stop the dummy from rotating, clone the accessory, change accessory’s handle rotation to dummy’s primary part rotation (root part), parent it to the dummy and then resume dummy rotation. For some reason the rotation is incorrect and while spamming the button the accessory slightly moves for some reason.

accessory rotation code:

plrAccessory.Handle.Rotation = Vector3.new(plrAccessory.Handle.Rotation.X,plrAccessory.Handle.Rotation.Y, clothingTester.PrimaryPart.Rotation.Z)

rotating dummy code: (it rotatesby 1)

while rotating == true do -- rotation loop
		wait() -- wait for process to finish
		-- set rotation CFrame (rotate by 1) --
		local newCFrame = model.PrimaryPart.CFrame * CFrame.Angles(0, rad(rotateAmount), 0)
		model:SetPrimaryPartCFrame(newCFrame)
	end

Try attaching the accessory to the dummy instead of rotating them both independently.

1 Like

And how would I do that? I am sorry I’m new to this type of stuff.

Make sure the dummy has the needed attachments. You can just playtest the game and find the attachments (in the baseparts of your character), copy them and add them to the dummy. You can then use Humanoid:AddAccessory()

1 Like

I checked and it does have those attachments like FaceCentreAttachment in the face and other ones in other body parts. And I did switch it for humanoid:AddAccessory() but still the rotation isn’t correct. Whenever I press the button that puts the accessory onto the dummy the accessory faces the direction of the camera instead of the direction where the dummy is facing.

After some testing these 2 lines of code nearly fixed it.

clothingTester.Humanoid:AddAccessory(plrAccessory)
plrAccessory.Handle.Rotation = Vector3.new(clothingTester.Head.Rotation.X, clothingTester.Head.Rotation.Y, clothingTester.Head.Rotation.Z)

Position of the accessory isn’t always perfect but it’s good enough, thanks for helping tho.

1 Like

Shouldn’t it be “Handle.Orientation”?

Similarly you should be using the X component of the orientation of the head when creating the Vector3 value.