i need help with my code

okay so im new to unity and would like some help i am making a 2D platformer.
my issue is when my player hits the enemy and is “kill” it destroys the gameobject of the player and the main camera has nothing to follow so it causes an error.

MissingReferenceException: The object of type ‘GameObject’ has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
CameraSystem.LateUpdate () (at Assets/Scripts/CameraSystem.cs:20)

i would like the game to reset when it can nolonger detect the players gameobject
or have the main camera change and follow the enemy

this is for a school project so i need help ASAP please