Tool still damages the player holding it even when using if to check if it's not the holder getting touched by it

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I am trying to make the tool not detect the player that is touching it

  2. What is the issue? Include screenshots / videos if possible!

External Media
-- wait(0.1)
local plr = script.Parent.Parent.Parent
local char = plr.Character
local idle = char.Humanoid:LoadAnimation(script.Animations.Idle)
local equipped = false
local attacking = false
local RaycastHitbox = require(game.ServerScriptService.RaycastHitboxV4)
local Hitbox = RaycastHitbox.new(script.Parent.Weapon)

local attack1 = char.Humanoid:LoadAnimation(script.Animations.Attack1)


Hitbox.OnHit:Connect(function(hit, humanoid)
	attack1:AdjustSpeed(2)
	local damage = math.random(50,65)
if humanoid then
	if hit.Parent ~= char then
		
			
			

				humanoid:TakeDamage(damage)
				script.Parent.Weapon.Hit:Play()
		
		







			
		humanoid.Parent.keffect.effect.Value = "headboom"

				
		end
	end
end)

script.Parent.Equipped:Connect(function()
	
		idle:Play()
		equipped = true

end)


script.Parent.Unequipped:Connect(function()
	idle:Stop()
	equipped = false
end)
script.Parent.Activated:Connect(function()

	if not attacking and equipped then
		
	
		attack1:Play()
		attacking = true

		wait(1.2)
		Hitbox:HitStart()
		script.Parent.Weapon.Swing:Play()

		wait(0.24)
		Hitbox:HitStop() 
		
		wait(0.24)
		attacking = false
		

	end
end)



I assume you are using Raycast Hitbox 4.01, here’s its documentation.

1 Like

I am but the issue is the way it’s still detecting the player holding it when it’s not supposed to

In the previous mentioned documentation, you can find a guide to use the Ignore List .

You mean it still doesn’t disable if the player unequips it?

1 Like

Sorry I just didnt look in the document enough but thank you also no

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.