Hey, I am very very new to both Unity and Javascript so please bear with me with how simple my question is.

I am just trying to figure out the basics of how this works so I want a “cube” object i created to move up a little when I press the “Space” button.

I came up with this so far (my understanding is noted with // so whoever will respond can tell me if im correct)

function Update () { //every moment
if (Input.GetButtonDown("Jump")) //if Space bar is pressed down
transform.position = Vector3.up; //move the position of the object up along the z axis
}

obviously it doesn’t work any help is very appreciated

function Update () { //every moment
if (Input.GetButtonDown("Jump")) //if Space bar is pressed down
transform.position += Vector3.up; //move the position of the object up along the z axis
}

In fact, you want to translate the object a little every time you press the spacebar. However, with your script, you simply assign a specific coordinate whenever you press the spacebar: but this operation will not change its results over time (the coordinates are always the same)!.

A final thing: watch out, because maybe you are translating the object in the wrong direction: if you wanna move it along the Z axis, you should useVector3.forward, and not “up” (which is for the Y axis).