Piran is not well connected to the rest of Slovenija, Italy or Croatia and you will probably find that the information given at Piran touristinformation about example the last train to Ljubljana is not true.
There fore the best way to get from Piran and elsewhere might very often end up being with the thomb. It is normal to hitch hike in Slovenija and many does so and know where to stand, so ask around. If you wanna go to Ljubljana, you should look for LJ. It is also easy to get a hike to Trieste in Italy or Istria in Croatia. Make a sign for where you wanna go.
-And if you are driving, then please stop for a hitch hiker
Piran has no railway station. The main bus station is located at the entrance of town directly on the sea shore, about 400 m from Tartini Square. There are regular bus connections from/to TRIESTE (nearest airport at Ronchi dei Legionari!), LJUBLJANA and the 'capital of the Slovenian coast', KOPER.