In my script that finds if the building is being touched.
local Part = script.Parent.TouchBox
local Attacked = script.Parent.Attacked
local Health = Part.Parent.Health
local Found = Instance.new("NumberValue", Part)
Found.Value = 0
while Attacked ~= nil do
wait(1)
Found.Value = 0
local Parts = Part:GetTouchingParts()
for i,v in pairs(Parts) do
if v.Parent.Name ~= "Tub" and v.Parent.Name ~= "Workspace" then
if v.Parent.Name == "Brute" then
print("Brute Touching")
Found.Value = Found.Value + 1
Attacked.Value = true
else
print("Nope")
print(Found.Value)
print(v.Name, v.Parent.Name.. " is this one's parent!")
end
end
end
wait(0.2)
if Found.Value == 0 then
Attacked.Value = false
print("Not Being Attacked")
end
end
I’m testing it with two different NPCS. One made by me and another one that is default.
Properties of Left Hand of my NPC

if v.Parent.Name == “Brute” then
Is not detected when touched.
Properties of Left Hand of other NPC

if v.Parent.Name == “John Doe” then
Is detected when touched.
So I’m not sure if it’s an issue with their properties causing :GetTouchingParts() to not work or an issue with my script. Please help because this is very confusing