Hi again, Denise,
There are a couple of factors in comparing train/bus vs. bus. A lot depends on how much time you want to spend in St. Andrews. The bus from Edinburgh takes about 2 1/2 hours, but is city centre to town centre. The train (from Waverley) to Leuchars takes about one hour and five minutes, and the bus from Leuchars to St. Andrews takes about 15 minutes. Taxi would be even faster, albeit possibly more expensive, depending on how many there are in your group.
So by taking train/bus as opposed to just the bus, you save about an hour's travel time each way. You need to compare the difference in cost between the two routes to determine which works better for you.
One problem with purchasing advance train tickets is that by getting the cheapest, rock bottom price, you are committing yourselves to taking a specific train. If for some reason you miss that train, you end up paying a whole lot more. Best thing to do would be to buy off peak day return tickets on the day that you're going, or get off peak anytime tickets the day before your planned travel. If you're travelling at peak (commuter) times, all bets are off. Best to purchase the tickets from a live person, rather than from a kiosk. That will minimize the confusion.
If you're spending the whole day, then it may be best to purchase peak tickets for the outward journey, and off peak for the return.
In addition to the town itself, there is West Sands, where the opening sequence of Chariots of Fire was filmed (cue Vangelis' theme), the Cathedral and the castle.
Have a wonderful time!