Exploding Zombie

For Loop with Part Touch

local zombie = script.Parent

local exploded = false


for _, part in pairs(zombie:GetChildren()) do

if part:IsA("BasePart") then

part.Touched:Connect(function(otherPart)

local player = game.Players:FindFirstChild(otherPart.Parent.Name)

if player and not exploded then

exploded = true

local explosion = Instance.new("Explosion")

explosion.Parent = game.Workspace

explosion.BlastRadius = 5

explosion.Position = part.Position

end

end)

end

end

Humanoid Touch Event

local zombie = script.Parent

local exploded = false


zombie.Humanoid.Touched:Connect(function(hit, limb)

local player = game.Players:FindFirstChild(hit.Parent.Name)

if player and not exploded then

exploded = true

local explosion = Instance.new("Explosion")

explosion.Parent = game.Workspace

explosion.BlastRadius = 5

explosion.Position = limb.Position

end

end)