When my player has a ForceField, I'm still able to take damage from a zombie in my game. How can i add to this code so that the zombie cannot hurt me when my character has a ForceField?
Damage Script on the Left/Right "LowerArm"
function onTouched(hit)
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil) and (script.Parent.Parent.Humanoid.Health > 0) and (game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)) then
human.Health = human.Health - 5
end
end
script.Parent.Touched:connect(onTouched)

3 comments
It’s best to format this as a debounce. if (hit.Parent:FindFirstChild("ForceField") then return end.
Thx, it worked!
:TakeDamage() on the humanoid also doesn’t do damage if a forcefield is used, but both ways can work.