https://devforum.roblox.com/t/raycast-hitbox-module-for-all-your-melee-needs/374482 Can anyone help me with this raycast hitbox module. For some reason every time I hit something the first time it only prints the hit.Name Once, But if you keep doing it, it keeps adding the amount of times it prints by 1

event.OnServerEvent:Connect(function(character)
    if canSwing then
        canSwing = false
        newHitBox.OnHit:Connect(function(hit, humanoid)
            if hit.Parent.Name ~= sword.Parent.Name then
                returnPartHit(hit)
                print(hit.Name)
                newHitBox:HitStop()
            end
        end)
        newHitBox:HitStart()
        wait(1.5)
        canSwing = true
    end
end)

5 comments

0

Ok I know what happen. When the output have the same printed line, like you spamming print(1) ten times, the output will look like this: 1(x10)

1

Have you ignored your character bcuz its hitting itself

0

I have hit.Parent.Name ~= sword.Parent.Name, I figured out the problem, the event stacks every time its fired but I don't really know how to fix it.

0

Use :FindPartOnRayWithIgnoreList(Ray,IgnoreList) to ignore the sword and character.