As I understand it, Scotland is only a member of the EU through the UK. If they left the UK, they would leave the EU and have to rejoin. That risk was actually a major argument used for voting to remain in the UK back when the referendum happened.
The primary issue there was that the EU refused to pre-negotiate anything with the Scottish government before the referendum, saying that they wouldn't negotiate with a non-sovereign government or something, only the UK government. If there's a democratic mandate for independence confirmed by a referendum, and the EU continued to refuse to negotiate with us, we would probably have to rely on the UK government to negotiate the terms on our behalf. I don't particularly want to rely on Boris Johnson and Michael Gove in that kind of situation to obtain the best possible deal for us.
That said, we'll have to see how the EU is responding to us. I'm quite pessimistic about the EU considering how thoroughly they shafted us in 2014 and how they shafted the Greeks and the Ukrainians, but my hope is that they will take a different stance following the Brexit vote. In the best-case scenario they will allow some kind of negotiations to take place while Scotland is still a member of the United Kingdom, pre-independence declaration, and therefore a part of the EU throughout the process. That would probably involve representatives from the UK and Scotland, as well as Europe.
I might be underestimating the spitefulness of the EU top-table governments, and their punitive actions towards the UK right now aren't really doing anything to change my mind, but I really hope they come to their senses and see the benefits of supporting us - potentially the largest English speaking country in the EU, with the largest coastline that you can actually do stuff with and the only sovereign country sharing a land-border with England, with direct links to the financial centre in London (or what'll be left of it in the years to come). The problem I suppose is that the very concept of any country seeking independence and doing rather radical things like that offends the sensibilities of the Eurocrats.
On the contrary: The first goal of the EU will be ensuring this never happens again. The UK collapsing into splinters would absolutely make their day.
During the prior referendum, it was very much a case of internal politics; the UK was part of the EU, and so getting involved in any way which would upset the one government of the two that will 100% be there the next day is off the table.
But today, the UK has made it very clear that it is no longer internal politics, as it is effectively no longer inside the EU. And there won't really be a negotiation of terms for anything between the EU and UK. A negotiation, as it is usually understood, consists of two parties attempting to minimize harm to themselves while maximizing their own benefit. However, due to the questions brought up about whether the EU itself will even survive this, maximizing their own benefit not only entails doing good for their citizens and people affected by this, but also entails maximizing the harm enacted against the UK to ensure this never happens again and spreads elsewhere.
If there are negotiations, they will probably be solely between the EU and representatives from Scotland, and will probably involve "accidental" leaks about the talks detailing how, with all this investment money freed up, most of the money previously earmarked for the UK would end up going to Scotland.
Getting Scotland out of the UK and into the EU not only greatly spites the UK, but it reduces the effect of Brexit on the EU itself. They'll probably do just about anything short of paying to print up your campaign banners.