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

Break is not a valid member of MeshPart?

trying to make a part detect if whatever's touching it has a value called "Break" then it will run "test". any solutions?

script.Parent.Touched:Connect(function(hit)
	if hit.Break then
		print("test")
	end
end)

2 comments

0

Is break in the characters body part, or just character?

0

in the torso, so in the bodypart

1 answer

That errors because you aren’t checking for existence. Break doesn’t exist. If you want to check if it exists, use FindFirstChild. Try this script out:

script.Parent.Touched:Connect(function(hit)
      if hit:FindFirstChild("Break") then
            print("test")
      end
end)

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