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

How to make a script ignore a curtain parts material?

So when i touch a part to the sound corresponded with the material it picks up plastic only cause legs and feet touch each other is there a way i can make the script ignore players legs

script.Parent:WaitForChild("LeftFoot", "RightFoot", "LeftLeg", 	"RightLeg").Touched:Connect(function(tuch) -- tuch is the thing it touches.
local mv = script:WaitForChild("Material")
mv.Value = tuch.Material.Name -- tuch's material

1 answer

You can add an if statement inside the touched event to filter out the other Materials like this

local brick = workspace.plasticDetector

brick.Touched:Connect(function(hit)
	if hit.Material == Enum.Material.Plastic then
		print("It's plastic")
	end
end)

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