Setting up two players (local multiplayer)

I’m making a local multiplayer game (for the first time) and I have a quick question as to how I should set up my scripts and project in general to work well.

Basically I have a script for movement, shooting, GUI and so on. I have set up a second movement script for player 2 (essentially the same script with different inputs). Is this a good way to go about setting up a project like this?

I’m asking because most of my scripts dont actually refer to the player gameobject just the object that they are attached too, so if I set up a set of duplicate scripts that essentially have a different name but still do the same thing so that player 2 will have its own health and weapon select is this good practice? Or should I for example have a shooting script that then refers to each player individually through gameobject.find or a public game object and drag each player into the inspector?

Thanks in advance!

Generally speaking, code duplication (i.e. writing code in two places that performs the same function) is always bad: it’s inefficient and hard to maintain.

Personally, I make all my players instantiate from the same generic player prefab with identical scripts, and have a “playerNum” variable set to, e.g. 1,2,3… to control and per-player functionality.