How do you make your game playable for 2 people after it's finished?

I haven’t finished the game yet but i want to know after i finish it how to make it so me and a friend can play the game against each other on computers. I want to know how this is done.

Do you already have built-in multiplayer support? Then you need someone with opened ports to host a dedicated or listen server, and the others can connect to him.

If you not already have the multiplayer support, this is going to be a bigger thing, you need to make all parts of your project multiplayer compatible.

It would be better to design the game around multiplayer support. You can’t just write a few lines of code and have a multiplayer game.

Unreal has been built with multiplayer game development in mind, and uses a concept called replication. This works by replicating relevant data between the server and clients. Here is an extract from the docs to give an example of replication:

… You see two opponents running
towards you, shooting at you, and you
hear their shots. Since all of the
game state is being maintained on the
server rather than on your machine,
why can you see and hear those things
happening?

You can see the opponents because the
server has recognized that the
opponents are relevant to you (i.e.
they are visible) and the server is
currently replicating those Actors to
you. Thus, you (the client) have a
local copy of those two player Actors
who are running after you. You can see
that the opponents are running toward
you because the server is replicating
their Location and Velocity properties
to you. Between Location updates from
the server, your client simulates the
movement of the opponents locally. You
can hear their gunshots because the
server is replicating the
ClientHearSound function to you. The
ClientHearSound function is called for
a PlayerPawn whenever the server
determines that the PlayerPawn hears a
sound. …

I recommend you visit the docs, google a bit and get a solid understanding of networking and replication before doing anything more to your game.

You can visit the networking section of the docs here. Networking Overview for Unreal Engine | Unreal Engine 5.3 Documentation

Edit: I also recommend reading the tutorial here A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums