Hello everyone! So, i’m having trouble trying to make an NPC use it’s right arm to point at the closest player to it. I have tried using Motor6Ds to achieve this, but i can’t seem to even get the arm to budge at all. Here is what i have tried doing thus far: (both did not make the arm move even a bit)
Attempt 1: (Trying to do a simple “Point at this part”)
game["Run Service"].Stepped:Connect(function()
if pointing then
print("Pointing")
humanoid.Parent.Torso["Right Shoulder"].Transform = CFrame.new(humanoid.Parent["Right Arm"].Position, target.Character.PrimaryPart.Position)
end end)
Attempt 2: (Using a modified version of this guide)
game["Run Service"].Stepped:Connect(function()
if pointing then
print("Pointing")
local RotationOffset = (humanoid.Parent["Right Arm"].CFrame-humanoid.Parent["Right Arm"].CFrame.p):inverse()
local RealPos = -(humanoid.Parent["Right Arm"].CFrame.p - target.Character.PrimaryPart.Position).unit * 5000
humanoid.Parent.Torso["Right Shoulder"].Transform = RotationOffset * CFrame.new(Vector3.new(0, 0, 0), RealPos)
end end)
I should also note, there is a part welded to the right arm, but the part is not anchored, can’t collide with anything, and is mass-less. This is also my first time messing with Motor6Ds besides doing animations.
As always, any help will be greatly appreciated!