How to make the players camera follow the head when playing an Animation in First Player Lock

Dear Developers,
Today I was trying to make a player crouching animation when pressed a certain button, when I tested it everything was working fine, there is just one thing that is annoying that pretty much breaks the entire point of the script.
Is it somehow possible to make the camera follow the motion of the animation when the player is in First Person the entire time?

local uis = game:GetService("UserInputService")

local crawlAnimation = script:WaitForChild("Crouch")
local loadedCrouchAnim

local crawlIdle = script:WaitForChild("CrouchIdle")
local loadedIdleAnim

local isCrouching = false

local humanoid = script.Parent:FindFirstChild("Humanoid")


uis.InputBegan:Connect(function(key, gameProcessed)
		
	if key.KeyCode == Enum.KeyCode.LeftShift then
				
		
		if isCrouching then
		
			isCrouching = false	
			
			if loadedCrouchAnim then loadedCrouchAnim:Stop() end	
			
			loadedIdleAnim:Stop()			
			
			game.ReplicatedStorage.OnCrouchBegun:FireServer(humanoid, 18, 40)
				
		elseif not isCrouching then

			isCrouching = true	
	
			loadedIdleAnim = humanoid:LoadAnimation(crawlIdle)
			loadedIdleAnim:Play()
			
			game.ReplicatedStorage.OnCrouchBegun:FireServer(humanoid, 5, 30)
		end
	end	
end)


game:GetService("RunService").RenderStepped:Connect(function()
		
	if not isCrouching then return end
		
	if humanoid.MoveDirection.Magnitude > 0 then
		
		if not loadedCrouchAnim then loadedCrouchAnim = humanoid:LoadAnimation(crawlAnimation) end
		if loadedCrouchAnim.IsPlaying == false then loadedCrouchAnim:Play() end	

	else
		loadedCrouchAnim:Stop()
		loadedIdleAnim:Play()
	end
end)

You can try:

local cam = --Camera
local head = --Playerhead
head.Changed:Connect(function() -- Checks always when Position changes
cam.CFrame = head.CFrame
end)

It sady did not work, it just kinda glitched the camera of the player, nothing else.

you would have to do some calculation and before that set your camera to scriptable and after its finished set it back to custom

Try this script, but Note that its only for standing still or animations it glitches out if you use it while moving

local cam = workspace.CurrentCamera
local head = script.Parent:WaitForChild("Head")
cam.CameraType = Enum.CameraType.Scriptable
while true do
	wait()
	cam.CFrame = head.CFrame
end

thats just simply bad if he wants to tween the camera

while loops are bad practice unless you are making 2 or more things run at the same time

I already tried to use .Changed Events which didn’t work and that was the only thing that did work, you can limit it to 0.07 seconds though and reduce lag.