It says for me that target does not exist in current context, how do I fix this?

using UnityEngine;
using System.Collections;

public class MovingPlatform : MonoBehaviour {

public float speed = 1;

private int direction = 1;

//Update is called once per frame
void Update() {
    transform.Translate(Vector3.forward * speed * direction * Time.deltaTime);

void OnTriggerEnter(Collider other) {
    if(other.tag == Target){ 
        if (direction == 1)
            direction = -1;
            direction = 1;


Your target tag doesn’t quite look right.

Try setting it as a string.


@voncarp That fixed the errors, but for some reason the platform that I’m trying to move left and right doesn’t seem to want to move. I’m new to coding so if you can help with this problem it would be incredible!