It certainly can but an independent Scotland would not automatically be a member of the EU.
They would have had to apply for membership and even though it would have certainly been speedrun (unless the UK would have been petty and tried to block their admittance) there would still have been some turmoil until they were admitted.
And now they got the turmoil without any option of being part of the EU.
Edit: proper tenses so it's clear this is with regards to how the situation was for the referendum of 2014.