I don't get any errors from

script.Parent.Touched:Connect(function(hit)
	local Nokill = {"hellericc","POP"}
	local humanoid = hit.Parent:FindFirstChild("Humanoid") 
	for _,x in pairs(Nokill) do
	if hit.Parent.Name == x  then
		print("T0ched by 0016-1") ---------------- this prints but I still take damage from it 
	elseif  (humanoid ~= nil) then
		humanoid:TakeDamage(20)
		
	end 
	end
	
end)

--- I tried hit.Parent.Name == x then and hit.Parent == x then None of them work, If I do it without the table it works but I want the table cause I want a group of players not to take damage instead of just one player.

2 comments

0

Check for the Humanoid first, then evaluate. Switch to an else clause. Use UserIds as they're static identifiers.

0

dont use that elseif, use another if. EXAMPLE; if hit.Parent.Name ~= x then because the elseif is in the if function. So its going to complete it.