Script doesn't work when laoding the game from the menu (which are in two different scenes),Switching from Scene to Scene in game stops my script from working.

So I am making a game for my college project and I have got a main menu that starts the game when you press play. It switches from Scene2 which is the main menu to Scene1 which is my actual game. I have enemies that follow the player in the game Scene and the script for it works fine when loading the scene by itself however the script doesn’t work when you load the scene from pressing start in scene 2. If anyone can help it would be greatly appreciated!

I guess what you are trying to say is the script doesn’t work once you switch scene.
If so then just insert this piece in the script on the gameobject which you don’t want to be destroyed in Start or Awake method

DontDestroyOnLoad(gameObject);