What is wrong with this onTouched script? It's a brick (HitBox) hitting a mesh named B2, and I'm checking in output and all I see is "It isn't B2, It is B2!", which obviously is contradicting. So something is wrong and I can't seem to name it. B2 is in a model named Car, and the script is in HitBox.
local B2 = script.Parent.Parent.Parent.Car.B2
local HitBox = script.Parent
HitBox.Touched:Connect(function(Part)
if Part.Name == B2 then
print("It is B2!")
script.Parent.Parent.B3.Transparency = 0
script.Parent.Parent.B3.CanCollide = true
script.Parent.Parent.B1.Transparency = 1
script.Parent.Parent.B1.CanCollide = false
else
print("It isn't B2, it is ".. Part.Name .."!")
end
end)

2 comments
Try if Part.Name == 'B2' ?
I'm so dumb, should've thought of that. Thank you so much!