Camera bug when player respawns a second time

Everytime i try to spawn in as a morph or a normal player a second time and setting the camera to custom the camera is not connected to the humanoid im guessing because i tried manually setting the camerasubject manually through the playtest and that worked but in the script it didnt is there anyway i can fix this?

(Clip of what is currently happening)

-- here is the function
function CivSpawn()
    ScreenGui.Enabled = false
    CameraConnection:Disconnect()
    Cam.CameraType = Enum.CameraType.Custom
    --[[ Camera Connection is a thing i made for the camera to follow the mouse cursor but it
         Change the Subject to the mouse cursor so i am honestly stuck on this problem
         PS - the function works after clicking the ImageButton i use.
    --]]
end

Fixed it by changing something in another part of the script.