add force object with input of mouse

I wanted to make a script to adjust the power of the launch of an object based on what I hold down the mouse button. This is my script. There is definitely something wrong but I can not find the problem

#pragma strict

public var speed : float;
private var bar : float = 25;
private var myInt = 0;
public var sfera : GameObject;
public var coord : Vector3;
public var forza : ForceMode;




function Start(){

}


function Update(){

   if(Input.GetMouseButton(0)){
   
    speed += bar * Time.deltaTime;
    
    myInt = Mathf.FloorToInt(speed);
    
    
    print(myInt);
    
    
   
   }
   
   
   if(Input.GetMouseButtonUp(0)){
  
   
     sfera.rigidbody.AddForce(coord,forza);
       
       //myInt = 0;
   
   }
   

}

function OnGUI(){

GUI.Label(Rect(10,10,100,100),"Power: " + myInt);


}

I’m not sure how javascript’s variable declaration is but I think your myInd perhaps is missing it’s declaration type?

What’s the wrong with it btw?