Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isn't this Hair Cloning onto an NPC?

Asked by 9 years ago

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

Log in to vote
0
Answered by
RedCombee 585 Moderation Voter
9 years ago

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.

0
Thanks! AlphaPro720 5 — 9y
0
You may also need to change the rotation of the hat. RedCombee 585 — 9y
Ad

Answer this question