Help with Motor6D 'Neck' Position Pointing At My Character's Head Position [Looking for a quick and simple solution)

I’ve been fiddling with my script for numerous hours now trying to get an R6 humanoid rig’s neck motor to follow my character’s head position around in game.

To sum it up real quick, I’m trying to get an R6 humanoid’s head (the npc’s head) to follow my character’s head position around in game at all times. I’ve come close multiple times but this task has shaved valuable time away and I need to ask someone who is more knowledgeable than me.

Here is what I’ve been working with. I’ve researched countless times and I’m still unable to figure out why the head refuses to look at my character’s head. The code below rotates the head to the left about 90 degrees. It is not pointing towards the origin, I’ve tested it with different rotations and it turns its head to the left.

Looking for a simple and quick solution.

local stare = game.Workspace.StaringEntity
local neck = stare.Torso.Neck
local char = game.Players.LocalPlayer.Character
local yOffset1 = neck.C1.Y
local yOffset0 = neck.C0.Y
neck.C1 =, yOffset1, 0) 
neck.C0 =, yOffset0, 0)
local direction = CFrame.lookAt(neck.C0.Position, char.Head.Position) --This is what should be controlling the npc's head to look directly at mine but doesn't work properly
	neck.C0 = direction

This is probably super easy to accomplish but I have a very basic understanding of Motors, CFrames, etc.
Thanks for reading, I appreciate that.

You need to set the C0 only and not the C1. Then u can multiply that value by cframe.LookAt or whatevers.

So if what you are doing is trying to get the npc to look at your head, you could do something like this:

local yOffset = neck.C1.Y
local direction = CFrame.lookAt(neck.C0.Position, char.Head.Position)
local angle = math.atan2(direction.lookVector.X, direction.lookVector.Z)

    neck.C1 = (0, yOffset, 0) * CFrame.Angles(0, angle, 0)

I haven’t confirmed if this works yet, I’ll update this post once I do.

Sorry for the late reply, I’ve just tested this and I get nearly the same result.

Unless there is supposed to something in front of “(0, yOffset, 0) * CFrame.Angles(0, angle, 0)”

Sorry for late notice, I’ve tried this before and you need to set the y values of the C1 and C0 of the motor otherwise the head snaps oddly.

This is what it looks like if you don’t set both the y values of C1 and C0 of the neck motor:

Ultimately, the head snaps widely in the direction that corresponds to C1 or C0. (For me at least)

Do ```Lua
local yOffset = neck.C0.Y
neck.C0 =,yOffset,0) *,,neck.C0.Y,neck.C0.Z))

Try, looking at the source code of the Motor6D manipulation within this project, it should be able to accomplish the task. Just remember that the C0 is relative the Part0 CFrame in object space while the CFrame.lookAt is relative to the world’s axis so you can’t directly set it the C0 of the motor6D.

1 Like

So here is the result with your code:

However, I tweaked it a little and managed to make the head eject upward like a rocket:

I will examine this and will let you know if I solve my problem. Thanks.

I’m back. I feel that this would work, however I’d much rather use something that is much simpler than this as I’m new to lua scripting and I like to understand how every script in my game works. However, I appreciate you sharing this as it likely will solve this issue and any issues like it.

If there is anyone reading this, definitely check this developer’s post.

If anyone knows a simpler way I can execute a simple npc head that looks at my head in a local script, let me know.

I have yet to find a solution. I will make another reply here once I figure out a simpler solution and have the time to do so.