I am trying to make the whole players body go invisible but i don't know how to get the hair from a character
script.Parent.Touched:connect(function(h) if h.Parent:FindFirstChild("Humanoid") ~= nil then h.Parent:FindFirstChild("Left Arm").Transparency = 1 h.Parent:FindFirstChild("Right Arm").Transparency = 1 h.Parent:FindFirstChild("Left Leg").Transparency = 1 h.Parent:FindFirstChild("Right Leg").Transparency = 1 h.Parent:FindFirstChild("Torso").Transparency = 1 h.Parent:FindFirstChild("Head").Transparency = 1 h.Parent:FindFirstChild("Head").face.Transparency = 1 end end)
We can use a Generic For Loop
. We can then use the IsA
function to check if what's returned IsA("Hat")
. We will also use IsA to check if what's returned is a part.
script.Parent.Touched:connect(function(h) if h.Parent:FindFirstChild("Humanoid") ~= nil then h.Parent:FindFirstChild("Head").face.Transparency = 1 for i,v in pairs(h.Parent:GetChildren()) do if v:IsA("Hat") then v:FindFirstChild("Handle").Transparency = 1 elseif v:IsA("Part") then v.Transparency = 1 end end end end)
Hats have things called Handles, and if you set the Handle's transparency to 1 it makes it invisible. I tested this and it worked fine.
remove :FindFirstChild