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

What did I do wrong?

Asked by 10 years ago
local Morpher = script.Parent

function onTouch(Brick)
for item, child in pairs(Brick.Parent:GetChildren())
do if child.ClassName == 'Hat' then
child.Name = "Cap"
child.Handle.Mesh.MeshId = "http://www.roblox.com/asset/?id=16190466"
child.Handle.Mesh.TextureId = "http://www.roblox.com/asset/?id=51278992"
end 
end
end
Morpher.Touched:connect(onTouch)

1 answer

Log in to vote
0
Answered by 10 years ago

Any errors? I cant see anything wrong with it. Maybe

child.ClassName == 'Hat'

Should be

child:IsA("Hat")

?

Ad

Answer this question