Help with character head movement!

Hey guys/gals, I’m trying to make the player characters head to look in the direction of the camera. I have done a bunch of research till I came to a video by @okeanskiy. He showed using the “neck” motor6D you can make the players head look in the direction of the camera. I then hit a road block. Since its being done locally other players cant see you looking around. He had a second version with it on the server but it doesn’t seem to work. How can I display the players head movement on the server so all can see it? Thanks!

Okeanskiy’s Code

local Camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
 
local Character = Player.Character
local Root = Character:WaitForChild("HumanoidRootPart")
local Neck = Character:FindFirstChild("Neck", true)
local YOffset = Neck.C0.Y
 
local CFNew, CFAng = CFrame.new, CFrame.Angles
local asin = math.asin
 
game:GetService("RunService").RenderStepped:Connect(function()
    local CameraDirection = Root.CFrame:toObjectSpace(Camera.CFrame).lookVector
    if Neck then
        if Character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
            Neck.C0 = CFNew(0, YOffset, 0) * CFAng(0, -asin(CameraDirection.x), 0) * CFAng(asin(CameraDirection.y), 0, 0)
        elseif Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
            Neck.C0 = CFNew(0, YOffset, 0) * CFAng(3 * math.pi/2, 0, math.pi) * CFAng(0, 0, -asin(CameraDirection.x)) * CFAng(-asin(CameraDirection.y), 0, 0)
        end
    end
end)

You may want to use RemoteEvents every second or two and tween the Motor6D to fit with the clients, thus allowing other players to see it, while the client’s own movement can be smooth.

1 Like

Other players will be able to see it, movement of unanchored parts (which include those belonging to the character model) replicate to the server.

It doesn’t though, I have tested with friends.

I fixed it by just moving the head on server then the client. It is a bit choppy but I should be able to fix it.