Skinned Mesh | Head Movement

I’ve searched far and wide around the dev forums and youtube but can’t find a head movement script for a rigged character model so I attempted to make one myself. I succeeded but I failed, The script itself works (I think) but the head isn’t exactly moving. Currently I’m just aiming more towards functionality then after Ill work on optimizing it a bit better.

Script
local ClientCamera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character
local NeckBone = Player.Character:FindFirstChild("RootPart").LowerSpine.Bone["Bone.001"]["Bone.002"]

game:GetService("RunService").RenderStepped:Connect(function()
	if NeckBone then
		local camDirection = Player.Character.HumanoidRootPart.CFrame:ToObjectSpace(ClientCamera.CFrame).LookVector
		NeckBone.Orientation = camDirection
		print(NeckBone.Orientation)
		print(camDirection)
	end
end)```

https://gyazo.com/9bdbeb11a60c637174297087a1a57287


Bone properties

4 Likes

I suggest using WorldOrientation not orientation.Because the Cframe of the bones is like that the attachments they don’t use Cframe they use WorldCframe.