Game breaks after player changes character

So to understand a bit what i have, when the player joins i make the CurrentCamera scriptable and set the CFrame to a part in workspace for my main menu and their character is placed in a spawn box. When they click play the camera is set from scriptable to costum and their characters HumanoidRootPart CFrame changes to a parts CFrame in workspace to teleport them from the spawn box to the game.

Everything works fine so far no errors or anything that could break it (With their normal character). However, When a player changes their in game character and they click play it breaks it, The camera is stuck in the air and the character stays in the spawn box..

Character change script:

local Characters = game:GetService(“ReplicatedStorage”).Characters
local Event = game:GetService(“ReplicatedStorage”).Events.ChooseCharacter

Event.OnServerEvent:connect(function(player,character)
if character == “PlayerCharacter” then
player:LoadCharacter()
else
local char = Characters[character]:Clone()
char.Name = player.Name
player:LoadCharacter()
player.Character = char
player.Character.Parent = workspace
player.Character.HumanoidRootPart.CFrame = game.Workspace.PlayerSpawn.SpawnLocation.CFrame
end
end)

did a small mistake on the script above should be fixed now*

Changing the player’s character, as far as the current loading events go, should also fire CharacterAdded and the PlayerModule should be taking care of updating the camera when the character changes. That’s pretty interesting. Never looked deeply into the CameraModule.

I’m not sure how to resolve your issue of the character not being repositioned to the appropriate location, however for the Camera make sure you also change CameraSubject - simply changing the Camera’s type back to Custom won’t be enough and you shouldn’t rely on the behaviour of changing the CameraType to recenter it back to the character; always, if you can, set CameraSubject.