More smooth camera movement with crouching?

I have a basic crouching and sliding script for a game that is in first person. The player camera offset changes whenever the player starts sliding or crouching. The only issue is that the camera movement is very sudden, and you can even see the player’s torso for a few milliseconds. How can I fix this?

code:

local ray = Ray.new(char.Head.Position, ((char.Head.CFrame + char.Head.CFrame.LookVector *2) - char.Head.Position).Position.Unit)
local IgnoreList = char:GetChildren()
local hit, pos = game.Workspace:FindPartOnRayWithIgnoreList(ray, IgnoreList)

if hit then
	if crouching == true then
		char.Humanoid.CameraOffset = Vector3.new(0, -1, -(char.Head.Position - pos).magnitude)
	elseif sliding == true then
		char.Humanoid.CameraOffset = Vector3.new(0, -1.5, -(char.Head.Position - pos).magnitude)
	else 
		char.Humanoid.CameraOffset = Vector3.new(0, 0, -(char.Head.Position - pos).magnitude)
	end
else
	if crouching == true then
		char.Humanoid.CameraOffset = Vector3.new(0, -1, -0.5)
	elseif sliding == true then
		char.Humanoid.CameraOffset = Vector3.new(0, -1.5, 1)
	else
		char.Humanoid.CameraOffset = Vector3.new(0, 0, -1)
	end
end

video:Streamable

bumping this to the top because I haven’t gotten a response yet.

You can use tween service instead of instantly moving the camera downwards. Tweenservice would smoothly move the camera down. I can give you an example of your script with tweens if you want.