How do I make my game object to keep moving to the right?

Hi, I am trying to make a Geometry Dash type of game, and I cannot seem to get this object moving. I tried many scripts but they all didn’t work, even the sidescrolling script that comes with Unity. I also need it that when you press the Spacebar, you jump. How can I do this? Thanks, it’s my first time trying Unity2D.

Hi, this should make your object to keep moving to the right.

using UnityEngine;
using System.Collections;

public class Move : MonoBehaviour {

 
    public static float distanceTraveled;
 
    void Update () {
        transform.Translate(5f * Time.deltaTime, 0f, 0f);
        distanceTraveled = transform.localPosition.x;
    }
}

Def. take a look at the Mario tutorial from Walker Boys Studio, it should give you some pointers http://walkerboystudio.com/html/unity_training___free__.html

Doesn’t work… But there were no errors.