How can i replicate this game's camera movement?

So i have an emote system in my game, But im currently trying to figure out how to make the camera kind of move toward your head, but delay behind a little, but also have some camera limits, so it wont follow the head if the head is pretty far away.

I’m trying to make it like Nico’s Nextbots.
Example:

I’m not very good with camera movement like this.

Any help is appreciated!

the solution is really easy

basically the camera default target is the character root part, but to make sure it moves with the head you need to set the camera subject to the head

ex.

local cam = workspace.CurrentCamera
local character = game.Players.LocalPlayer.Character

cam.CameraSubject = character.Head

and for getting back:

cam.CameraSubject = character.HumanoidRootPart

Sorry, This isnt what i wrote.

Making the CameraSubject just the head isnt really what im looking for.

Its the humanoid, Not the root part, otherwise the camera would look odd

Hello, this should work:

-- parent -- game -> StarterPlayer -> StarterCharacterScripts

task.wait(.5)

local run = game:GetService("RunService")

local cam = game.Workspace.CurrentCamera

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

local head = char:WaitForChild("Head")
local hrp = char:WaitForChild("HumanoidRootPart")
local hum = char:WaitForChild("Humanoid")

local cam_offset = CFrame.new()
local lerp_time = 0.3

local function update_cam(dt)
	cam_offset = cam_offset:Lerp(CFrame.new() + (hrp.CFrame + Vector3.new(0, 1.5, 0)):ToObjectSpace(head.CFrame).Position, lerp_time)
	
	hum.CameraOffset = cam_offset.Position
end


run.RenderStepped:Connect(update_cam)

and here’s a version that is immediate:

-- parent -- game -> StarterPlayer -> StarterCharacterScripts

task.wait(.5)

local run = game:GetService("RunService")

local cam = game.Workspace.CurrentCamera

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

local head = char:WaitForChild("Head")
local hrp = char:WaitForChild("HumanoidRootPart")
local hum = char:WaitForChild("Humanoid")

local function update_cam(dt)
	hum.CameraOffset = (hrp.CFrame + Vector3.new(0, 1.5, 0)):ToObjectSpace(head.CFrame).Position
end


run.RenderStepped:Connect(update_cam)

Amazing! Works very well, However, Is there a way to make the camera smoothly go back to
normal when the camera doesnt need to follow the head?

something like this should work:

-- parent -- game -> StarterPlayer -> StarterCharacterScripts

task.wait(.5)

local run = game:GetService("RunService")

local cam = game.Workspace.CurrentCamera

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

local head = char:WaitForChild("Head")
local hrp = char:WaitForChild("HumanoidRootPart")
local hum = char:WaitForChild("Humanoid")

local cam_offset = CFrame.new()
local lerp_time = 0.3 -- can be a value between 1 and 0, 1 being immediate, 0 being infinitely slow
-- closer value get's to 0 the slower the camera lerps

local cam_offset_enabled = true

local function update_cam(dt)
	local to_lerp_cframe = (cam_offset_enabled and CFrame.new() + (hrp.CFrame + Vector3.new(0, 1.5, 0)):ToObjectSpace(head.CFrame).Position) or CFrame.new(0, 0, 0)
	
	cam_offset = cam_offset:Lerp(to_lerp_cframe, lerp_time)

	hum.CameraOffset = cam_offset.Position
end

run.RenderStepped:Connect(update_cam)

when cam_offset_enabled = true the camera will lerp to the heads position like it did originally and when false it will lerp back to 0, 0, 0