Making an object move upwards in vector3 with javascript

Hello. I need to give an object a force upwards, when spacebar is pressed. I’m just a amateur hobbyist, so can you post a simple script, that’s easy as possible to understand.

I’ve tried this kind of script, but it gives me numerous errors:

 var moveup = (transform.position(Vector3.up));


As I said, I’m just an amateur and that script might look stupid to the eyes of a more professional scripter.

Maybe you should try to add a Rigidbody to the GameObject and then try to use a code like this:

var moveup = rigidbody.AddForce(Vector3.up * 10);