So what I have is this:

while wait() do
        local ray = Ray.new(
               workspace["Test Dummy"].Torso.CFrame.p,  
            (workspace["Test Dummy"].Torso.CFrame.p - workspace["Test Dummy"].Torso.CFrame.lookVector).unit * 100 
        ) 
         local hit, position, normal = workspace:FindPartOnRay(ray, nil)
        print(hit)
    end

I was wondering how I would detect if the dummy is facing the character? What that code does is that it only prints Right Arm for some reason.

3 comments

0

Check to see if it's hitting the character's right arm or if it's hitting it's own right arm.

0

Easiest way to do this is print(hit:GetFullName())

0

Yeah but I'd like to detect if the player is in the way of it.