Need help detecting when a sword has hit a character

Im trying to figure out how i could detect when a sword collides with another npc, I tried using .Touched however it fires a remoteevent for each thing it touches i only want it to touch 1 thing so it doesnt attack the npc multiple times in 1 animation, But if you know how i could do this please let me know. I understand there is modules i could use but i dont really like using modules that isnt necessary for a simple system.

Region3s can be used to detect what exists in a specified 3D space

1 Like

There gotta be a more common and simpler way to do this.

You can create A Part inside the NPC and Make it Transparent.
This will be the Hitbox of the NPC.

now you can probably just do something like

local Hitbox=NPC.Hitbox
local debounce=false

     if debounce==false then debounce=true
          -- Damage NPC HERE
          wait(5) -- cooldown

You could use my module that I made for this, it could be helpful.


Here’s a game with the module to try it out as well.

I’ve tried this, The cooldown part isnt to accurate so i passed on using this, However it would technically work, But dont plan to use this.

Touched event is not very great to use for hitboxes so try using me, gtg now,

1 Like

You can check if the 1st parameter on a touched event is equal to a certain thing. And use a debounce to make it only hit once.

1 Like

nope i tried this and did not work

Yeah it wouldn’t work the best because it’ll have a debounce for others, so instead you need to use table.find and table.insert to help you.