How I make gun not damage the player

I made a script of gun damaging the zombie, but it is taking the damage on the player too, and I want the gun not damage the player, here is what I have done:

local tool = script.Parent
local handle = tool.Handle

local enabled = true

local shotSFX = handle.Shot
local shotEffect = handle.Attachment.ParticleEmitter
local shotLight = handle.Attachment.PointLight

tool.Activated:Connect(function()
	if not enabled then return end
	enabled = false
	shotSFX:Play()
	shotEffect.Enabled = true
	shotLight.Enabled = true
	wait(0.1)
	shotLight.Enabled = false
	shotEffect.Enabled = false
	wait(0.2)
	enabled = true
end)

tool.GunEvent.OnServerEvent:Connect(function(player, target)
	if target:IsDescendantOf(player.Character) then
		print("Cannot damage the player")
	else
		local humanoid = target.Parent:FindFirstChild("Humanoid")
		
		if humanoid then
			humanoid:TakeDamage(15)
		end
	end
end)

It’s not killing anyone and only print the message

Nevermind, is working but it keeps damaging the player

I have found another way to this work, I appreciate your help by the way