Moving a object up and down

I have to make a object go up and down repeatetly so that i can jump it from another platform! I really need help! P.s its C#

I think that you want something like this.

private Vector3 startPosition; bool up=true; // Use this for initialization void Start () { //maxSpeed = 3; startPosition = transform.position; } // Update is called once per frame void Update () { MoveVertical (); } void MoveVertical() { var temp=transform.position; print (up); if(up==true) { temp.y += 0.01f; transform.position=temp; if(transform.position.y>=0.39f) { up = false; } } if(up==false) { temp.y -= 0.01f; transform.position=temp; if(transform.position.y<=0.14f) { up = true; } } }

Thanks in advanceā€¦