Need help to prevent head go glitchy when first person

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!
    so the head is normal im first person but when i go into first person it just go randomly very fast

  2. What is the issue? Include screenshots / videos if possible!
    the issue is the head moving randomly while on first person
    issue video:

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

-- script to move head
script.Parent.LookCamera.OnServerEvent:Connect(function(mh,CameraDirection52)
	if Player:FindFirstChild("Humanoid") then

		if Player:FindFirstChild("Humanoid").Health ~= 0 then
			Player.HeadLookPosition.Value = Vector3.new(CameraDirection52.X,CameraDirection52.Y,CameraDirection52.Z) 

		
		end		
		end
end)
	camPart.Position = Player.Head.Position 
	camPart.CFrame = CFrame.new(camPart.Position,Player.HeadLookPosition.Value) * CFrame.fromOrientation(0, math.pi, 0)
	
	--	camPart.CFrame = CFrame.new(camPart.Position,Player.Head.Position)
	
	camPart.Position = Player.Head.Position
--localscript to move head for the server
repeat wait(.1)
	
until game.Players.LocalPlayer.Character:FindFirstChild("Head")
game["Run Service"].RenderStepped:Connect(function()
	local camera = workspace.CurrentCamera.CFrame.Position

	local cameralol = workspace.CurrentCamera.CoordinateFrame * CFrame.fromOrientation(0, math.pi, 0)

	script.Parent.LookCamera:FireServer(camera)
end)

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.
ok

1 Like

I made it so it follow the mouse and not the camera, it work but i still want the camera

Any help would be appreaciatted!

local Game = game
local Workspace = workspace
local RunService = Game:GetService("RunService")
local Players = Game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Head = Character:WaitForChild("Head")
local Neck = Head:WaitForChild("Neck")
local Camera = Workspace.CurrentCamera

local function OnRenderStep()
	Neck.C0 = CFrame.new(Neck.C0.Position) * Camera.CFrame.Rotation
end

RunService.RenderStepped:Connect(OnRenderStep)

Its a value, make another one but without a whole code, just something like * cframe.rottation

i will try to put cframe rotation on the head follow script 1 sec
it doenst work but ok

The script I provided works in its current state.

Its a value, vector3 value not a c1 c0 thingy lol

im the video the head following camera is FE which FE means that show for the server i think but ok but i didn’t ask you to do a whole code, pls dont do that or else im gonna get punished i think

@Forummer, theres a camerapart when u rotate it it will rotate the head like its the own camera, is theres any script that can work by rotation or something like that that can show for the server tell me some tips and not a whole code lol

i did it make so it show for the server, but its weird the head doenst follow as you expected

i have the video if you want lol*

theres also a part inside of the head when u rotate the head also rotate, give me any tips to make it work?

--LOCAL

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 Head = Character:WaitForChild("Head")
local Neck = Head:WaitForChild("Neck")
local Camera = Workspace.CurrentCamera

local function OnRenderStep()
	Neck.C0 = CFrame.new(Neck.C0.Position) * Camera.CFrame.Rotation
	RemoteEvent:FireServer(Neck.C0)
end

RunService.RenderStepped:Connect(OnRenderStep)
--SERVER

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 Head = Character:FindFirstChild("Head")
	if not Head then return end
	local Neck = Head:FindFirstChild("Neck")
	if Neck then Neck.C0 = NeckC0 end
end

RemoteEvent.OnServerEvent:Connect(OnRemoteFired)

how’d u send that so fast, thanks @forummer i will give +1 solved

where do i put server? im the serverscirptservice?

It still broken, i will show the video 1 second


it still broken it doest folow the camera

HeadCamera.rbxl (30.4 KB)

wow it worked fine thanks +1 solved again cuz idk why lol

forummer i will try r6 but i wont remove the solution ok