Making an NPC rig's right hand point at a player

Here is something I did for a flashlight it uses Mouse.Hit but you can change that to the cframe.new(Vector3,Player)

local jointPosition = ArmMotor6D.Part0.CFrame:toWorldSpace(CFrame.new(0.9,0.25,0.25))
local cframe = CFrame.new(jointPosition.p, PlayerTorsoPositionOrWhatever) * CFrame.Angles(math.pi/2, 0, 0) * CFrame.new(0, -1, 0)
ArmMotor6D.C0 = ArmMotor6D.Part0.CFrame:toObjectSpace(cframe)

This should work for the most part.

5 Likes