Touching a part while it's in the middle of an animation

I have an attack animation, and I need to detect if the player’s hand touches another player during the animation. I cannot find anything online to help. Just using a normal BasePart.Touched:Connect() event listener does not work.


In the above clip, player2 should be being flung back by a force of 100000 times the normalized distance between player1’s hand and player2’s HumanoidRootPart, plus a force of 50000 upwards.
Is it possible to detect a collision with an object mid-animation?

1 Like

i think that most body parts are non collide
try checking with get parts in part or smth like that

1 Like

Nope, no hierarchal issues in my code, and I have definitely worked with colliding body parts.

1 Like

A hit box is recommended as sometimes an animation may not play or play correctly do to users network.
For this however I would use a Keyframe Marker in the animation, and when the marker is reached, use:

Example Code

This code may not work 100%. It’s just for demonstration.

local hitTable = {} -- hit multiple players but not same one(per animation)

local parts = Hand:GetTouchingParts() -- just as it says(hand is right arm/righthand)
if #parts > 0 then -- make sure there are part(s) touching
for count,part in parts do -- loop through all the parts
    local humanoid = part.Parent:FindFirstChild("Humanoid") -- check if their parents have a humanoid
     if humanoid then -- they got one!
           if not table.find(hitTable,part.Parent) then -- check if being hit
                 table.insert(hitTable,part.Parent) -- now they are being hit
                 humanoid:TakeDamage(10) -- deal damage to part's parent's Humanoid
                 -- make sure to remove player from table to attack the player again
           end
     end
end
      
end

Also collision does not need to be on for Touch to work. Just CanTouch does.

1 Like

This doesn’t seem to work either. I’ll try a different form of combat.

1 Like