Player dying and getting damaged by tool

Hello, im having a problem with this module.
Everytime i reset my character gets damaged by his own tool again.

At first it works but then after he dies it doesnt.

Im using the raycast made by TeamSwordphin

Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RaycastHitbox = require(ReplicatedStorage.RaycastHitboxV4)
local tool = script.Parent.Parent
local cd = false
local plr = game.Players.LocalPlayer
local MyCharacter = plr.Character or plr.CharacterAdded:Wait()
local handle = tool.Handle
local hitbox = tool.hitbox



local Params = RaycastParams.new()
Params.FilterDescendantsInstances = {MyCharacter}
Params.FilterType = Enum.RaycastFilterType.Blacklist

local newHitbox = RaycastHitbox.new(script.Parent)
newHitbox.RaycastParams = Params
newHitbox.Visualizer = false
newHitbox.DebugLog = false



newHitbox.OnHit:Connect(function(hit, humanoid)
	if newHitbox.RaycastParams ==  Params then
	print(hit)
		humanoid:TakeDamage(30)
	end
end)

tool.Activated:Connect(function()
	if cd == false then
		cd = true
		wait(.425)
		newHitbox:HitStart()
		wait(1)
		newHitbox:HitStop()
		wait(1.725)
		cd = false
	end
end)

Try checking if the hit humanoid doesn’t belong to the player in the OnHit event. This should make it impossible for the player to hit themselves with their own tool.

newHitbox.OnHit:Connect(function(hit, humanoid)
	if newHitbox.RaycastParams ==  Params and humanoid.Parent ~= MyCharacter then
	print(hit)
		humanoid:TakeDamage(30)
	end
end)
2 Likes

Thank you, worked exactly how i wanted it to.