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)
Forcefields are stored in the player model, so you could add an if statement checking for that forcefield.
if hit.Parent:FindFirstChild("ForceField") == nil then human.Health = human.Health - 5 end