Raycastparams trouble

The player takes damage even though the parameter is supposed to exclude the player, the one thats trying to exclude the other player hit doesnt work as well.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local playerss = game:GetService("Players")
local localplayer = playerss.LocalPlayer
local char = localplayer.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local RayCastHitbox = require(ReplicatedStorage.RaycastHitboxV4)
local kit = game.Workspace:WaitForChild("Kitvalue")
local db = false
local hitchar = {}
local keybind = "e"
local hitbox = hrp:WaitForChild("Hitbox")
local Params = RaycastParams.new()


Params.FilterDescendantsInstances = {char} 
Params.FilterType = Enum.RaycastFilterType.Exclude

Params.CollisionGroup = "Default"
local new_hitbox = RayCastHitbox.new(hitbox)
new_hitbox.RaycastParams = Params 

local onHitEvent = game.ReplicatedStorage.onHitEvent

new_hitbox:HitStart()
task.wait(0.7)
new_hitbox:HitStop()
game.UserInputService.InputBegan:Connect(function(inp, Typing)
	if db then return end
	if Typing then return end
	if kit.Value == "1" then 
		if inp.KeyCode == Enum.KeyCode.E then
			
			hitbox = hrp:WaitForChild("Hitbox")
			new_hitbox = RayCastHitbox.new(hitbox)
			new_hitbox:HitStart()
			new_hitbox.OnHit:Connect(function(hitPart, hitHum)
					table.insert(hitchar, hitHum.Parent)
					onHitEvent:FireServer(hitHum)
					
			end)
			Params:AddToFilter(hitchar)
			print(hitchar)
			print(Params)
			wait(0.7)
			new_hitbox:HitStop()
			db = true
			task.wait(2.3)
			db = false
		end
	end

end)

It might be because of how you’re doing the filtering. I think when you do

it removes the already initialized character. Try an if statement like this:

if not table.find(hitCharacters, hitCharacter) then – Checking if the char is already in table
table.insert(hitCharacters, hitCharacter)
Params:AddToFilter({hitCharacter}) – Exclude chars already hit
onHitEvent:FireServer(hitHum)
end

Sorry if I’m misunderstanding the question.

No your completely right, this was my question, thanks for the help, I ended up with this as the solution to my problem. The issue was that all players and rigs have their humanoid just named humanoid. So instead this code now checks for if the hithum is the same as hitchar.Parent which would be the name of the rig/player that got hit.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local playerss = game:GetService("Players")
local localplayer = playerss.LocalPlayer
local char = localplayer.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local RayCastHitbox = require(ReplicatedStorage.RaycastHitboxV4)
local kit = game.Workspace:WaitForChild("Kitvalue")
local db = false
local hitchar = {}
local keybind = "e"
local hitbox = hrp:WaitForChild("Hitbox")
local Params = RaycastParams.new()

--- remember to define our character!
Params.FilterDescendantsInstances = {char} 
Params.FilterType = Enum.RaycastFilterType.Exclude

Params.CollisionGroup = "Default"
local new_hitbox = RayCastHitbox.new(hitbox)
new_hitbox.RaycastParams = Params 

local onHitEvent = game.ReplicatedStorage.onHitEvent

new_hitbox:HitStart()
task.wait(0.7)
new_hitbox:HitStop()
game.UserInputService.InputBegan:Connect(function(inp, Typing)
	if db then return end
	if Typing then return end
	if kit.Value == "1" then 
		if inp.KeyCode == Enum.KeyCode.E then
			
			hitbox = hrp:WaitForChild("Hitbox")
			new_hitbox = RayCastHitbox.new(hitbox)
			new_hitbox:HitStart()
			new_hitbox.OnHit:Connect(function(hitPart, hitHum)
				if hitHum == char:FindFirstChild("Humanoid") then return end

				if hitHum.Parent == (hitchar[1]) then return end
				Params:AddToFilter({hitchar}) -- Exclude chars already hit

				print(hitHum.Parent)
				table.insert(hitchar, hitHum.Parent)
				onHitEvent:FireServer(hitHum)
			end)
			Params:AddToFilter(hitchar)
			
			print(hitchar)
			print(Params)
			wait(0.7)
			table.remove(hitchar, nil)
			new_hitbox:HitStop()
			db = true

			task.wait(2.3)
			db = false
		end
	end

end)