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)
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)
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.
2 comments
Is break in the characters body part, or just character?
in the torso, so in the bodypart