Head Rotation Not Working after Reset

Hello everyone,

I noticed this small bug in this script where if the user dies, the head won’t rotate after their appearance is loaded again. Why is this?

local cam = workspace.CurrentCamera

local plr = game.Players.LocalPlayer

local char = plr.Character or plr.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")

local neck = char:FindFirstChild("Neck", true)

local y = neck.C0.Y

if plr.CharacterAppearanceLoaded then
	game:GetService("RunService").RenderStepped:Connect(function()

		if neck then

			local camDirection = hrp.CFrame:ToObjectSpace(cam.CFrame).LookVector

			neck.C0 = CFrame.new(0, y, 0) * CFrame.Angles(0, -camDirection.X, 0) * CFrame.Angles(camDirection.Y, 0, 0)
		end
	end)
end

Thanks!

Aki

Put this script as a child to StarterCharacterScripts, so that when the character dies, the script runs again.

1 Like