What is wrong with my rotation code? (i am new to coding)

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

public class RotatingObstacle : MonoBehaviour {

public float rotationSpeed = 5f;

void Update()
{
	transform.rotation.y - rotationSpeed;
}

}

this is my code for rotating obstacle but it doesnt work? what did i do wrong? i get error: “error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement” but i dont know what that means.

Hmm.

public float rotationSpeed = 5f;

void Update ()
{
    transform.Rotate(Vector3.up, speed * Time.deltaTime);
}

or maybe

public float rotationSpeed = 5f;

void Update ()
{
    transform.rotation.y - rotationSpeed * Time.deltaTime;
}

I don’t know if it will work. Go try it out :slight_smile: