For train tickets check out German or Austrian railway operator.
Tickets for October are not yet bookable but should become available soon. Simply take the better offer.
https://www.oebb.at/en/
https://www.bahn.com/en
I can see 4 trains per day in October. 3 train connections during day time (6:15 h) and one night train (EN 40237).
For a 6 h journey I would prefer the train over a bus. Specifically on weekends the highways would be very busy with possible severe delays due to traffic jam.
If your schedule allows, of course you could split the journey in the middle and stay a night in Gastein valley. It’s a beautiful mountain valley with a lot of touristic infrastructure.
In Bad Gastein you could change directly from the train station into to gondola up to Stubnerkogel.