Camera not moving with animation

When I play my cutscene, it locks the camera on to the part like usual, but it does not move with the animation.

Camera code:

		plr.CameraMode = Enum.CameraMode.LockFirstPerson
		cam.CameraType = Enum.CameraType.Scriptable
		cam.CameraSubject = cameraPart
		cam.Focus = cameraPart.CFrame
		cam.CFrame = cameraPart.CFrame
		cam.HeadLocked = false

		stepped = game:GetService("RunService").Heartbeat:Connect(function()
			task.spawn(function()
				local x,y,z = cameraPart.CFrame:toEulerAnglesXYZ()
				cam.CFrame = CFrame.new(cam.CFrame.Position) * CFrame.Angles(x,y,z)
				task.wait(length)
				stepped:Disconnect()
			end)
		end)

Animation code (same script):

		for i, v in ipairs(people) do
			local personClone = v:Clone()
			
			game.Debris:AddItem(personClone,length)
			
			personClone.HumanoidRootPart.CFrame = personClone.CutsceneInfo.CFrameTeleTo.Value
			personClone.Parent = workspace.CutsceneObjects
			
			local anim = personClone.CutsceneAnimations:FindFirstChild(tostring(cutsceneUniqueNumber))
			local animTrack = personClone.Humanoid.Animator:LoadAnimation(anim)
			
			animTrack:Play()
		end

This is a modulescript.

2 Likes

An animation doesn’t change the Humanoid Root parts actual CFrame, all it does is offset all other parts of a body. So you probably have to animate the camera movements manually. Maybe there’s an easier way to do this but I can’t be really sure rn since im not specialized in camera animations.

2 Likes

not sure if this makes a difference:
the official documentation states that it’s better to use RenderStepped when coding a camera/character

2 Likes