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

How would i get the hair from a character?

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)

2 answers

✓ Accepted answer

Loop through the character and check if what's returned is a Hat.

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.

if I helped, please don't forget to accept my answer.

remove :FindFirstChild

1 comment

0

I don't want to remove i just want to make the Mesh Transparent..

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