Unaligned Hair Attachment as the Dummy Rotates

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
  • Aligned Hair in a Dummy.
  1. What is the issue?
  1. What solutions have you tried so far?
  • I can’t think of anything because this is my first time making like this.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local newAsset = HairTable[HolderValue.Value].Value:Clone()

--newAsset.Parent = CharacterDummy
CharacterDummy.Humanoid:AddAccessory(newAsset) --// The equip method

local newWeld = Instance.new("WeldConstraint")
newWeld.Part0 = CharacterDummy.Head
newWeld.Part1 = newAsset.Handle
		
newWeld.Parent = newAsset.Handle

Off-topic:

  • How do I rotate an NPC with anchored HumanoidRootPart? because I use unanchored HumanoidRootPart to rotate it with BodyAngularVelocity. But what if an exploiter found the Dummy and pushed it around, the Dummy would be in a different location. What’s the better way to it?

And if you do it only with Humanoid:AddAccessory()?
Humanoid:AddAccessory automatically rotates the accessory (must not be anchored)

And to rotate something anchored it is like this:

Part.CFrame *= CFrame.Angles(math.rad(90),0,0)

Here try this, there is a built in function in the humanoid called AddAccessory(). This is how you would use it. This seems to work for me, I put all of this code on the server and started spinning around and the hat loaded perfectly. I would test that is being shown on the server and on the client.

local humanoidObj = nil --Set this as the player's humanoid
local accessoryInstance = nil --the accessory you are attaching to the character

humanoidObj:AddAccessory(accessoryInstance) --adds the accessory to the humanoid

I used this code to test.

game.Players.PlayerAdded:Connect(function(p)
	local c=p.Character or p.CharacterAdded:Wait()
	local h=c:WaitForChild("Humanoid")
	
	wait(3)
	local itemModel = game.InsertService:LoadAsset(6352107732):GetChildren()[1]

	h:AddAccessory(itemModel)
end)

The accessory is unanchored and this is all done on the Server, if you didn’t catch the InsertService.

1 Like

I would just have the dummy only exist on the client. Even if the exploiter found that it was unanchored, then he wouldn’t be able to shove it in front of other people.

2 Likes

I have the solution now, thanks for your all suggestions!

1 Like

Are you able to please share the solution?

1 Like

Going back to this, applying/giving certain attachments to the Hat can make it attached to the head even if the character moves.

From this post scenario:

My hats don’t contain any attachments such as the HatAttachments and I rely on my scripts to position them on top of the head.

Solution:

  • Before you put the hat inside the humanoid model.
  • Select your hat, and open the Handle part.
  • Insert an Attachment object inside the Handle
  • Rename the Attachment into HatAttachment
  • Insert the Hat into the humanoid model and it will automatically position through the HatAttachment of the Head in the Humanoid model.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.