Below works and all but it only works one time for some reason. Basically what it does it checks if something that touches it is a zombie and if it is it loses health from the zombie by -1 from a value that is displayed on a GUI. For some reason it subtracts 20 from it but when the zombie touches it again nothing happens.
function onTouch(part)
local h = part.Parent:FindFirstChild("Zombie torso")
wait(3)
if h~=nil then
for i, v in ipairs(game.Players:GetChildren()) do
local n = v.PlayerGui.Notice.Box.Health1.Health.Value
n = (n -20)
v.PlayerGui.Notice.Box.Health1.Text = n
game.StarterGui.Notice.Box.Health1.Text = n
end
end
end
script.Parent.Touched:connect(onTouch)

2 comments
Why are you changing the gui in startergui if it's a health gui?
@Ryzox so if they die they will see it