Touched event still detecting handle

I have a snowball and I use a touched event for hit detection, I do have it check if the hit parent is a part of the player’s character or is a parent of the snowBall tool itself so it shouldn’t run if it’s either, why does this still detect the handle?

image

  ball.Touched:Connect(function(part)
        if part.Parent ~= character and part.Parent ~= snowBall then
            local hitCharacter = part.Parent
            local hitPlayer = game.Players:GetPlayerFromCharacter(hitCharacter)

            if hitPlayer and hitPlayer ~= player then
                local hitHumanoid = hitCharacter:FindFirstChild("Humanoid")
                if hitHumanoid then
                    hitHumanoid.Health = hitHumanoid.Health - damage
                end
            else
                local snowParticle = particles:FindFirstChild("Snow Particles"):Clone()
                snowParticle.Parent = workspace
                snowParticle.Position = ball.Position
                wait(0.01)
                snowParticle:FindFirstChild("ParticleEmitter"):Emit(50)
                game.Debris:AddItem(snowParticle, 0.5)
            end

            ball:Destroy()
        end
    end)

Hey! From what I’ve tested, you are printing accessory handles whose parent is not the character. So in this case, you should do the following:

ball.Touched:Connect(function(part)
	local character = tool.Parent
	if part:IsDescendantOf(character) or part:IsDescendantOf(tool) then return end
		
	-- your code
end)

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