Local head movement for R6 characters

I watched okeanskiy’s head movement tutorial so I could implement that into my game, but it didn’t work for R6. So I created this script that adds a Neck to the character when it spawns. (as R6 characters don’t have the motor6d neck)

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		local clon = Instance.new('Motor6D', char.Head)
		clon.Name = 'Neck'
		clon.Part0 = char.Torso
		clon.Part1 = char.Head
	end)
end)

that goes into the ServerScriptService /\

local camera = workspace.CurrentCamera
local character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.Character:Wait()
local root = character:WaitForChild('HumanoidRootPart')
local neck = character:FindFirstChild('Neck', true)
local yOffset = neck.C0.Y
local CFnew, CFang, asin = CFrame.new, CFrame.Angles, math.asin
game:GetService('RunService').RenderStepped:Connect(function()
    local camDirection = root.CFrame:toObjectSpace(camera.CFrame).lookVector
    if neck then
        neck.C0 = CFnew(0, yOffset+1.5, 0) * CFang(0, -asin(camDirection.x), 0) *    CFang(asin(camDirection.y), 0, 0)
    end
end)

this is okeanskiy’s script, this goes into the StarterCharacterScripts /
hope someone can use this in their EXPERIENCE

2 Likes

R6 rigs do have a neck. The Neck motor is what connects the Head to the torso part on any rig and there is even a property designed around it so Humanoids don’t die if it’s missing, RequiresNeck.

The problem is in the LocalScript code assuming that a Neck exists by the first FindFirstChild call when it should be a WaitForChild call instead.

4 Likes

Thanks!
I did not know that
also he made a second video which supports R6
so I guess this is it

1 Like

the cframes are messed up in the server side

Local head movement” mhm I have no idea why that could be

1 Like

I’m not sure if everyone wants to look like an akephaloi to other people