score:10
To an extent the answer depends on what you mean by 'medieval times'. The answer in 800 is very different from 1400. However, I'll have a go for the later medieval period, post Normanisation around 1100 until 1500.
The idea that Scotland in the late medieval period operated under some sort of 'clan system' is not true. 'Clan' is really just another name for 'family/kin' group. The broad family/kin group allegiances did have a great deal of influence in Scotland, as well as elsewhere, and particularly in the western isles and north of Scotland. However that's not the same as saying that clan chiefs were unchallenged rulers in their 'clan territories'.
In theory all of Scotland operated under feudal land tenure, common law and statutes originating from the Scottish crown. 'Clan chiefs' (and that's not a phrase that really exists until much later) held land as vassals of the king, and operated as his lieutenants in the localities in the implementation of law and order.
In reality, the greater the distance from the Scottish lowlands, the weaker the rule of royal law tended to be, and the 'Gaelic' west and north were for large periods only nominally ruled by the crown, and the influence of figures such as the Lord of the Isles was much stronger.
If you are talking about the lowlands, however, there the basic legal system was quite similar to the other Norman-influenced parts of Europe. Power and law were implemented by a variety of ecclesiastical and secular magistrates, such as justiciars and justices. It was that system that governed the lives of the majority of Scots, albeit the bonds of family loyalty and kin group were an important part of the culture.