Camera offset reseting after death

Hello, i have a problem that when i offset camera to the humrootpart it reseting after death
Any help will be great!

local char = plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local rootpart,head = char:WaitForChild("HumanoidRootPart"),char:WaitForChild("Head")
wait(0.1)
game:GetService("RunService"):BindToRenderStep("CameraOffset",Enum.RenderPriority.Camera.Value-1,function()
	hum.CameraOffset = (rootpart.CFrame+Vector3.new(0,1.5,0)):pointToObjectSpace(head.CFrame.p)
end)
hum.Died:Connect(function()
	hum.CameraOffset = (rootpart.CFrame+Vector3.new(0,1.5,0)):pointToObjectSpace(head.CFrame.p)
end)
1 Like

That is because the humanoid variable does not get updated after the player has respawned, which means it still is going for the dead humanoid and not the current one, you can do a CharacterAdded event to update the camera every time a character is respawned.

2 Likes