function ot(part) local zombie = script.Parent:FindFirstChild("Zombie") if zombie == nil then local humanoid = script.Parent:FindFirstChild("Humanoid") humanoid.Health = 0 end end script.Parent.Touched:connect(ot)
This script is made so that only zombies can pass through this door that the script is inside of. Inside of the zombie there is a humanoid named 'Zombie'
This script is supposed to make it so that when it's touched it try to find something called 'Zombie' and if it doesn't (if it's a player) then it'll kill the player, but it won't kill any zombies passing through it. The problem is that it always finds zombie as nill, even when a zombie goes through it. Any help with this?