Camera manipulation not working (Repost cause I was super unclear last time)

Hello! I’m manipulating the camera so it basically shows the ROBLOX game’s world, and after you choose your team it stops and you can view your main character again. Here is the code:

local chooseteam = game.Workspace.Haschosenteam
wait(2)
while true do

	local cam = workspace.CurrentCamera
	local focuspart = game.Workspace.FocusPart
	
	cam.CameraType = "Attach"
	cam.Focus = focuspart.CFrame
	cam.CameraSubject = focuspart
	wait(0.1)
	if chooseteam.Value == true then
		print("This part works")
		cam.CameraType = "Custom"
		break
	end
end

this is a local script in starter character scripts

It does print “This part works”, however a split second after you respawn, you go back to the cutscene part. Why is it not working?
Also: the focus part’s script is

while true do
	
	local direction = (math.random(-20,20)/80)

	local part = script.Parent

	part.Position = part.Position + Vector3.new(-1 * direction, 0, 0)

	local part = script.Parent
	local direction = 0.05
	game.workspace.FocusPart.CFrame = game.workspace.FocusPart.CFrame * CFrame.Angles(0,math.rad(0.5),0)
	wait()



	
end

Not sure whether knowing that would make a difference though.

Edit: I figured out how to do it! I just needed to change the CameraSubject back to humanoid.