I am making a zombie for my game and I want it to deal damage to the player, but it doesn't work
`local zombie = script.Parent
local workspace = game:GetService("Workspace")
local debounce = false
--Body parts of the zombie that can be used to damage the player
local LArm = zombie:WaitForChild("Left Arm")
local RArm = zombie:WaitForChild("Right Arm")
local Head = zombie:WaitForChild("Head")
local Torso = zombie:WaitForChild("Torso")
local humanoid = zombie:WaitForChild("Humanoid")
--finding the player
local vest = workspace:FindFirstChild("TacticalVest", true)
local Player = vest.Parent
local PlayerPos = Player.PrimaryPart.Position
humanoid.Touched:Connect(function(hit)
if hit.Parent == Player and not debounce then
debounce = true
Player.Humanoid.Health -= 20
print("Player hit")
print("Player health: " .. Player.Humanoid.Health)
wait(2)
debounce = false
end
end)`
The prints are not working so the touched event may not be firing.
** You are now Level 1! **