I'm making a multiplayer game with Unreal Engine, and I need to run some blueprint code on the client after they have connected to the server. This includes creating the HUD widget, uploading the player's loadout, etc. Where should I put this code so that it runs only on the client after connecting to a server?
In the sense the game framework is built upon, you define the HUDClass in the GameMode Class. The HUD code only runs on the client.
If you want to do something at the beginning, right after spawning and possessing the Pawn, I suggest you override BeginPlayingState inside the PlayerController and start from there (you can call GetHUD and start asking the hud to do whatever you want to show to the player).
In general, actions from the player should be done through the PlayerController, so if you want to show something on the HUD based on a player action you could use the PlayerController for that and then the PlayerController "delegates" the "business logic" of actually displaying the thing to the HUD class itself.
If you want to know more about the Gameplay Framework, consider reading this: https://docs.unrealengine.com/en-US/Gameplay/Framework/index.html