Camera is broken when switching rigs

I created a script that would change the player’s rig mid-game, but it completely broke the camera, and the player never respawns after resetting, and I can’t figure out how to fix these. Here is my script:


function PlayerAdded(player)
	

local Rig = game.Workspace.Rig:Clone()
	local id = player.UserId
	local playername = player.Name
	local character = game.Workspace:WaitForChild(playername)
print(id)
	print(Rig.Humanoid.Name)
	
Rig.Parent = game.Workspace
	Rig:WaitForChild("Humanoid"):ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(id))
	
	
	Rig.HumanoidRootPart.Position = character.HumanoidRootPart.Position
	Rig.Humanoid.DisplayName = playername
	player.Character = Rig
	
	
	local Camera = game.Workspace.Camera
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CameraSubject = Rig.Head
		Camera.CFrame = Rig.Head.CFrame
		print("i work")
end

game.Players.PlayerAdded:Connect(PlayerAdded)

When you set CameraType to Scriptable, it disables all the core camera scripts, therefore you will need to do all the camera movement manually. If you want to keep the normal camera functionality then don’t change the CameraType.

Are you trying to keep the camera in first person view?

Yea I am trying to keep the camera in first person

You can do this instead by changing the player’s CameraMaxZoomDistance to 0.5

Oh wait, sorry I wasn’t trying to keep the player in first person, the issue was that the player’s camera wouldn’t follow the player after switching rigs, and that whenever they reset, they wouldn’t respawn

Try just changing Camera.CameraSubject but don’t change Camera.CameraType

I tried doing that originally, but it still broke