@salvaliebana install joystick selection. Go into retropie menu. If you see joystick selection then it is already installed and go to paragraph 2. If it is not read paragraph 1.
In the retropie menu, go into runcommand. In there install joystick selection. Exit. Restart your pi.
Go into retropie menu, then into joystick selection. In option number 1 you can select which joystick is each player.