Need help on head following camera

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    ok, when autorotate is off the camera follow the head, but when its on …
    video down here

  2. What is the issue? Include screenshots / videos if possible!
    the issue is when i move my camera while walking, the head wont follow the camera like normal, it will just Aaa idk how can i explain it
    video:

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    no

script:

do
	local Game = game
	local Workspace = workspace
	local ReplicatedStorage = Game:GetService("ReplicatedStorage")
	local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")
	local RunService = Game:GetService("RunService")
	local Players = Game:GetService("Players")
	local Player = Players.LocalPlayer
	local Character = Player.Character or Player.CharacterAdded:Wait()
	local Humanoid = Character:WaitForChild("Humanoid")
	local Rig = Humanoid.RigType.Name
	local Limb = if Rig == "R6" then Character:WaitForChild("Torso") elseif Rig == "R15" then Character:WaitForChild("Head") else nil
	if not Limb then return end
	local Neck = Limb:WaitForChild("Neck")
	local Camera = Workspace.CurrentCamera

	local function OnRenderStep()
		Neck.C0 = CFrame.new(Neck.C0.Position) * Camera.CFrame.Rotation * if Rig == "R6" then CFrame.fromOrientation(-math.pi / 2, -math.pi, 0) else 1
		RemoteEvent:FireServer(Neck.C0)
		

	end
-- script by @Forummer
	RunService.RenderStepped:Connect(OnRenderStep)
end

by the way the script was made by @Forummer i gave him credits
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
k

You need the CFrame to be in ObjectSpace.

How can i use it, btw idk how to code lol

how can i use object and how can i put it idk how to code im not a programmer like you

that didnt help me btw, ur not replying back :v

You need to use CFrame:ToObjectSpace on the CFrame you are pointing the head to.

wait nevermind, but how’d i use * Camera.CFrame:ToObjectSpace()

The camera.CFrame.Rotation is the problem then.

yep, but how i use object space , do i need to put the rotation neck.c0 weld or head or something like that

It depends on the script you’re using. Usually, you just need to do Camera.CFrame:ToObjectSpace(head.CFrame)

btw theres another script to make it serversided

do
	local Game = game
	local ReplicatedStorage = Game:GetService("ReplicatedStorage")
	local RemoteEvent = ReplicatedStorage.RemoteEvent

	local function OnRemoteFired(Player, NeckC0)
		local Character = Player.Character
		if not Character then return end
		local Humanoid = Character:FindFirstChildOfClass("Humanoid")
		if not Humanoid then return end
		local Rig = Humanoid.RigType.Name
		local Limb = if Rig == "R6" then Character:FindFirstChild("Torso") elseif Rig == "R15" then Character:FindFirstChild("Head") else nil
		if not Limb then return end
		local Neck = Limb:FindFirstChild("Neck")
		if Neck then Neck.C0 = NeckC0
		end
	end

	RemoteEvent.OnServerEvent:Connect(OnRemoteFired)
end

it didn’t work, this just made my head fly and my character invis and invis every 0.2 frames
i can show video by the way

Okay that didn’t work. I think you need to do something else with CFrame.lookAt.

its the head following cam, idk how to use that neither but i will try
it doenst show at the “CFrame” list

ok but we are gonna ignore about the neck if the neck has something wrong?

It can also be an issue with the rigging and such. Otherwise it shouldn’t do that.

its for r6/r15, idk whats wrong with it

oh and just use lookat or follow the camera position or make it follow the mouse

idk how to code i’ve already said that
but i tried using Position but it just doenst work it gave me errors

so you just stole this code from somewhere?