CS1002 is a missing semicolon.
Please use code tags when showing code as its very hard to read otherwise Using code tags properly
You have a few problems with your script.
They are easy to spot if you put them into a code editor such as Visual Studio
The red lines indicate potential problems. Mouse over them for more details.
Code is case sensitive so you need to make sure to capitalize the classes, for example rigibody2D should be Rigidbody2D.
getcomponent should be GetComponent
You are also missing 2 semicolons,
1 after each line here
width = boxcollider.size.x
rb.velocity = new vector2(speed, 0)
This should be the end result
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class backgroundscroller : MonoBehaviour
{
private BoxCollider2D boxcollider;
private Rigidbody2D rb;
private float width;
private float speed = -3f;
// use this for initialization
void Start()
{
boxcollider = GetComponent<BoxCollider2D>();
rb = GetComponent<Rigidbody2D>();
width = boxcollider.size.x;
rb.velocity = new Vector2(speed, 0);
}
// Update is called once per frame
void Update()
{
if (transform.position.x < -width)
{
reposition();
}
}
private void reposition()
{
Vector2 vector = new Vector2(width * 2f, 0);
transform.position = (Vector2)transform.position + vector;
}
}