How can I make a level unlock system?

How can I have a level unlock system when I complete the first level of the game, it enables access to the second level in an order? I already have a level select screen as shown on the picture of the map below and I have a picture of a lock overlaying all but the first level. How can I make the locks actually work in the game instead of just being overlaying pictures?

P.S: To select a level, you use the arrow keys to move the 2d character move to a red dot and then you press space to select and load the level. After completion it takes you to this same screen. How do I have the locks work?

if you can show some code of where you are having difficulties it will help get the right response

GLOBAL persistent object active in all rooms to save data = (global var script)
at the end of each level example lvl1 save **level 1 complete ** to (global var script)
now in (global var script) do something like this

LOAD LEVEL STATS FROM (global var script)
LOAD SAVED DATA to unlock completed stages = load from saved data or player preff data saved on device or computer

bool level1unlock,level2unlock,level3unlock =false;
levelcomplete1 could be = load from saved data or player preff data saved on device or computer

//unlock lvl2
if( levelcomplete1 == true)
level2unlock = true;
//unlock lvl3
if( levelcomplete2 == true)
level3unlock = true;
you can use a switch statement to shorten things if you have many levels

because all levels are set to false apart from starting lvl1 and only after completing starting lvl1 will lvl1 unlock lvl2 and so on.
you should have a unlock system that only unlocks the next level after player clears the current stage they are in.

hope that helps