How would you make your player freeze for a certain amount of time?

I want to set up my code pretty much just checking for if the space bar is pressed, my character freezes for a certain amount of time, when that amount of time is up I want the player to be able to move again.

If the spacebar is pressed and the character controller is enabled, store Time.time and disable its character controller.

If the character controller is disabled and the current Time.time is greater than the saved Time.time plus the time limit, then re-enable it.

Variable do see if player is frozen or not and then just timing method to remove the freeze.

Something like this:

var playerFreeze : boolean = false;
var freezeTimer : float;

function Update(){
if(!playerFreeze){
    //Code that can be only used when player is not frozen
} else if(freezeTimer <= 0) {
    playerFreeze = false;
} else {
    freezeTimer -= Time.deltaTime;
}