How can I exclude the player's character from a Touched Event?

This is my code:

neon.Touched:Connect(function(thing)
if debounce1 == false then
if thing.Parent:FindFirstChild(“HumanoidRootPart”) and not thing.Parent:FindFirstChild(“db”) then
debounce1 = true

			local eHum = thing.Parent:FindFirstChild("HumanoidRootPart").Parent.Humanoid 
			eHum.Parent:WaitForChild("Checks").isStun.Value = true
			local isBlock = thing.Parent:FindFirstChild("Checks").isBlock
			local x = Instance.new("BoolValue", thing.Parent)
			x.Name = "db"
			game.Debris:AddItem(x,0.7)

			if player.Character:WaitForChild("BerserkTag",0.0001) then
				eHum:TakeDamage(60)
			else
				eHum:TakeDamage(30)
			end
			local OldeHumHealth = eHum.Health
			local back = Vector3.new(0,0,-3)
			local up = Vector3.new(0,-3,0)
			local bv = Instance.new("BodyVelocity", thing.Parent:FindFirstChild("HumanoidRootPart"))
			bv.Name = "Knockback"
			bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
			bv.Velocity = player.Character.HumanoidRootPart.CFrame.LookVector * 75 + back + up
			game.Debris:AddItem(bv,.1)

What this does is when it touches a humanoid, it will get knockbacked and get damaged. But if the player firing the action touches it, they will also get hurt and I don’t want that.

How about adding BoolValue wich shows doing a Action.

1 Like

Simply check if thing.Parent is not the character/player who initiated the attack.

1 Like