Android screen size script not working

I found this script on the internet, that should make the game fit all size phones. But it does not work! Maybe i missed something and thats why im asking here.

var originalWidth = 640.0;  // define here the original resolution
var originalHeight = 400.0; // you used to create the GUI contents 
 
function Start() {
    // calculate scales
    var scaleX : float = Screen.width / originalWidth;
    var scaleY : float = Screen.height / originalHeight;
 
    // find all texts and change the scale
    var texts : TextMesh[] = FindObjectsOfType(TextMesh) as TextMesh[];
    for (var text : TextMesh in texts) {
       text.transform.localScale = new Vector3(text.transform.localScale.x * scaleX, text.transform.localScale.y * scaleY, text.transform.localScale.z);
    }
 
    // find all gui textures and change the scale
    var textures : GuiTexture[] = FindObjectsOfType(GuiTexture) as GuiTexture[];
    for (var texture : GuiTexture in textures) {
       texture.transform.localScale = new Vector3(texture.transform.localScale.x * scaleX, texture.transform.localScale.y * scaleY, texture.transform.localScale.z);
    }
}

You use two types of a conclusion of the text. TextMesh in fact is the three-dimensional text. Most likely you should use GuiText. Then you should scale your GuiText and GUITexture correctly. I will show on one element, the rest becomes similarly(write on CSharp):

 float origW = 640.0f;
 float origH = 320.0f;

 void Start() {
  float scalex = (float) (Screen.width) / origW; //your scale x
  float scaley = (float) (Screen.height) / origH; //your scale y
  GUIText myText = Gameobject.Find("Mytext"); //find your element
  Vector2 pixOff = myText.pixelOffset; //your pixel offset on screen
  int origSizeText = myText.fontSize;
  myText.pixelOffset = new Vector2(pixOff.x*scalex, pixOff.y*scaley);
  myText.fontSize = origSizeText * scalex;
 }

And texture.localScale don’t scale your texture. For GUITexture you use pixelInsert, see docs Unity, or ask me. I hope that it will help you.