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

Custom hair comes off my head when I touch other player? HELP!!!

Asked by 6 years ago

Ok. So I made my character have custom hair, and it is an accessory with a handle in it named Handle, and in that is a mesh. I want to know - why does the hair get transferred from me to another player when I touch them? It is really annoying. Thank you - here is my code where I create the hair.

local acc = Instance.new("Accessory", char.Head)
acc.Name = "SSJHair"
local handle = Instance.new("Part", char.Head.SSJHair)
handle.Name = "Handle"
handle.CanCollide = false
handle.BrickColor = BrickColor.new("Lime green")
handle.Transparency = 1
handle.Material = "Neon"
local weld = Instance.new("Weld", handle)
weld.Name = "AccessoryWeld"
weld.Part0 = handle
weld.Part1 = char.Head
weld.C0 = CFrame.new(0, -0.5, 0)
local mesh = Instance.new("SpecialMesh", handle)
mesh.MeshId = "rbxassetid://430344159"
mesh.Offset = Vector3.new(0, 0.5, 0.5)
mesh.Scale = Vector3.new(6, 6, 6)
local attachment = Instance.new("Attachment", handle)
attachment.Name = "HairAttachment"
attachment.Position = Vector3.new(0, 0.1, -0)
attachment.Axis = Vector3.new(1, -0, 0)
attachment.SecondaryAxis = Vector3.new(0, 1, 0)
if acc:FindFirstChild("TouchInterest") ~= nil then
    acc:FindFirstChild("TouchInterest"):Destroy()
end

1 answer

Log in to vote
0
Answered by
Andorks 23
6 years ago
Edited 6 years ago

After the hair is put on the head, be sure to disable the script.

local acc = Instance.new("Accessory", char.Head)
acc.Name = "SSJHair"
local handle = Instance.new("Part", char.Head.SSJHair)
handle.Name = "Handle"
handle.CanCollide = false
handle.BrickColor = BrickColor.new("Lime green")
handle.Transparency = 1
handle.Material = "Neon"
local weld = Instance.new("Weld", handle)
weld.Name = "AccessoryWeld"
weld.Part0 = handle
weld.Part1 = char.Head
weld.C0 = CFrame.new(0, -0.5, 0)
local mesh = Instance.new("SpecialMesh", handle)
mesh.MeshId = "rbxassetid://430344159"
mesh.Offset = Vector3.new(0, 0.5, 0.5)
mesh.Scale = Vector3.new(6, 6, 6)
local attachment = Instance.new("Attachment", handle)
attachment.Name = "HairAttachment"
attachment.Position = Vector3.new(0, 0.1, -0)
attachment.Axis = Vector3.new(1, -0, 0)
attachment.SecondaryAxis = Vector3.new(0, 1, 0)
if acc:FindFirstChild("TouchInterest") ~= nil then
    acc:FindFirstChild("TouchInterest"):Destroy()
script.Disabled = true
end
0
That would work, except for the fact that what I put down is only part of the script. Disabling the script would disable the whole entire thing I was creating and you couldn't use it ever again. starwars5251977 48 — 6y
0
Not if you use it correctly. Andorks 23 — 6y
Ad

Answer this question