Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would you detect if a NPC is facing your character?

Asked by 6 years ago

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.

0
Check to see if it's hitting the character's right arm or if it's hitting it's own right arm. Tomstah 401 — 6y
0
Easiest way to do this is print(hit:GetFullName()) Tomstah 401 — 6y
0
Yeah but I'd like to detect if the player is in the way of it. script_ing 43 — 6y

Answer this question