How to crouch without falling through floor?

var controller : CharacterController;

okay I am trying to create a crouching script, but I am confused seeing as though my Player keeps falling through the collision mesh of the floor. Every time I crouch the player falls through the floor. What can I do so that the character, does not fall through the floor? I have tried "Yield get seconds passed", I have tried putting it in a series of steps but the game just ignores it.

How do I solve this issue?

function Update ()

{

if (Input.GetKey ("c")) {

  GetComponent(CharacterController);transform.localScale.y = 0.2; 

} else {

  GetComponent(CharacterController);transform.localScale.y = 1; 

}

}

First big issue is...

GetComponent(CharacterController);transform.localScale.y = 0.2; 

why is there a ; in the middle of it effectively your code reads

GetComponent(CharacterController);
transform.localScale.y = 0.2; 

So the GetComponent isn't doing anything...

So you aren't performing the transform on the CharacterController necessarily if that's what you intended.

Not sure that'll fix your problem, but thought I should point it out.

Simple: move the character controller a few centimeters up to the middle of your character. That fixed the problem for me.