So basically all I want this script to do if a zombie touches it the health on the gui goes down by one. But for some reason it's not working and I think I did something wrong.
function onTouch(part)
local humanoid = part.Parent:FindFirstChild("Humanoid")
local zombie = part.Parent:FindFirstChild("Humanoid").Name == "Drooling Zombie"
local n = PlayerGui.Notice.Box.Health1.Health.Value
if humanoid~=nil and zombie~=nil then
for i, v in ipairs(game.Players:GetChildren()) do
v.n = (n.Value -1)
v.PlayerGui.Notice.Box.Health1.Text = n.Value
end
end
end
script.Parent.Touched:connect(onTouch)

4 comments
is the humanoid's name Drooling Zombie?
Yes
FirstFindChild returns a child with the same name as the string. so if you try to find the humanoid's name, it should be humanoid.
@Hungryjaffer I just fixed it so finds the models name as Drooling zombie and it still does not work