I was going to do this script just to kill the zombies, but when I touch the part, I die. How do I make sure that both me and other players don't die when they get into it?
part.Touched:Connect(function(p)
if p.Parent:FindFirstChildOfClass("Humanoid") then
local plr = workspace[p.Parent.Name]
wait(1)
plr.Humanoid.Health = plr.Humanoid.Health - 20
wait(0.1)
part:Destroy()
end
end)

2 comments
I would rename the zombies humanoids to "Zombie" then replace the "p.Parent:FindFirstChildOfClass("Humanoid")" to p.Parent:FindFirstChildOfClass("Zombie") (this is how my weapons work, to prevent team killing), tell me if you need a better explanation of it
Nah it doesnt work :C. I Just did a weapon when you activate it, it create new part front of the player and it will be damage all things just not players. But i cant do it