Help with the movement

I managed to get the game object to loop up and down, but I need it to constantly go left and anything I try fails.
(I tried using velocity)
The code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ysaucermove : MonoBehaviour {


    public float amp = 0.75f;
    public float freq = 1f;




    // Position Storage Variables
    Vector3 posOffset = new Vector3 ();
    Vector3 tempPos = new Vector3 ();

    // Use this for initialization
    void Start () {

        posOffset = transform.position;



    }

    // Update is called once per frame
    void Update () {


    
        tempPos = posOffset;
        tempPos.y += Mathf.Sin (Time.fixedTime * Mathf.PI * freq) * amp;
    
        transform.position = tempPos;



    }

}

Any ideas, please?

Velocity isn’t working for you probably because you are explicitly setting the transform.position to tempPos every frame. Since you never change the x value of tempPos. Your object’s x is going right back to the beginning every frame.

Thanks for the explanation!
And what can I use instead of velocity?

You can still use Velocity, but you need to keep the x value instead of resetting it every frame;

Right after
tempPos.y += Mathf.Sin (Time.fixedTime * Mathf.PI * freq) * amp;

try adding:
tempPos.x = transform.position.x;

Edit: This is assuming that you are setting the Velocity somewhere. I don’t see it in the code that you posted.

Did it and it worked. Thanks a lot!