Missile.Payload.Touched:Connect(function(HitPart)
if HitPart.Name ~= 'Payload' or HitPart.Name ~= 'Engine1' then
if HitPart.Parent:FindFirstChild('Humanoid') then
local Plr = game.Players:GetPlayerFromCharacter(HitPart.Parent)
Plr.Character.Humanoid:TakeDamage(100)
elseif HitPart.Parent.Parent.Name ~= 'BodyKit' or HitPart.Parent.Parent.Parent.Name ~= 'BodyKit' or HitPart.Parent.Parent.Parent.Parent.Name ~= 'BodyKit' or HitPart.Parent.Parent.Parent.Parent.Parent.Name ~= 'BodyKit' then
print(HitPart.Parent.Parent.Name)
CreateExplosion(HitPart.Position, 20)
CreateTag(HitPart)
Missile:Destroy()
end
end
end)
This code here is for some reason running even though the HitPart.Parent.Parent.Name prints out BodyKit.
I’m very confused right now and I appreciate any help I can get. Thanks!
Not sure if that makes a difference, have you tried using elseif HitPart.Parent.Parent.Name ~= "BodyKit"?
Maybe it’s trying to compare a string (") with a character ('). Not sure if I am right, though, since I don’t do Lua a lot
It’s because:
Hit.Parent.Parent.Name is BodyKit
Hit.Parent.Parent.Parent.Name isnt BodyKit
you put OR so only one of the conditions must be respected to execute the code