Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why isn't this Hair Cloning onto an NPC?

Before you pointlessly dislike this question please think "Who would do this?" and "Would I like this if it was done to me?"1st of all I have an NPC I call Caitlyne with a humanoid and a roblox 1.0 body. She has a hat attached to her that is intentionally invisible. I used my script that will be up ahead to declare that hat as blond hair. I do not know why this isn't working:

`local Morpher = script.Parent
function onTouch(Brick)
for item, child in pairs(Brick.Parent:GetChildren()) do
if child.ClassName == 'Hat' then
child.Name = 'Hair'
child.Handle.Mesh.MeshId = 'http://roblox.com/asset/?id=62678172'
child.Handle.Mesh.TextureId = 'http://209.15.211.170/blonde-hair-item?id=94901960'
end
end
end`

1 answer

✓ Accepted answer

Note: Not tested.

local Morpher = script.Parent
function onTouch(Brick)
for item, child in pairs(Brick.Parent:GetChildren()) do
if child.ClassName == 'Hat' then
hair = child:Clone()
hair.Position = head.Position + Vector3.new(0,0.2,0) -- Edit this later if you do not like the positioning.
hair.Parent = script.Parent
end
end
end

By what the question was, I assume this is what you are looking for.

2 comments

0

Thanks!

0

You may also need to change the rotation of the hat.

This discussion is preserved as it was. New answers, comments, and votes are closed.