Beginner in need!

Ok, I have been searching the web for sometime now and I haven’t been able to come up with the answer, Maybe someone can give me a hand and tell me how TERRIBLY wrong I am doing this!

NOTE: I am new to JavaScript and relatively new to scripting in general.

What I am trying to achieve here is a constant movement in the direction I specify when I hold down the keyboard keys, and when I want it to stop it will do so on key release.

var Miner : GameObject;
var movementSpeed : float;

private var movementStop = 0.0;

function Update () {

// Forward Key Trigger

if (Input.GetKeyDown (KeyCode.T)  Input.GetKey (KeyCode.RightControl)) {

Miner.transform.position.z = (Time.time) + movementSpeed;

print("Forward Is Working");

  }

}

It move’s in the right direction but only if I keep hitting the activation key.

I would be grateful for ANY help I can get!

Input.GetKeyDown (KeyCode.T)

Should be:

Input.GetKey(KeyCode.T)

GetKeyDown will only be true on the downstroke of the key. You probably want to do something like this though:

Miner.transform.Translate(0, 0, movementSpeed * Time.deltaTime);

That Fixed it! :smile:

Thank you!