Trouble with tags

I am trying to get two things to rotate in opposite directions by using tags, but it is not working. I am pretty new to C#, but I feel that I have a basic understanding of it, but just in case I am doing something wrong. I am not getting any errors, it just doesn’t want to work. Here’s my code:

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

public class Rotation2 : MonoBehaviour {

private Transform Tm;
private Collider other;

// Use this for initialization
void Start () {
	Tm = GetComponent<Transform> (); 

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

		if (other.gameObject.CompareTag ("portal")) {
			Tm.Rotate (0, 0, -100 * Time.deltaTime); 
		if (other.gameObject.CompareTag ("pulse")) {
			Tm.Rotate (0, 0, 100 * Time.deltaTime); 



Your Collider variable isn’t initialized. If you’re trying to get the Collider component on the object this script is attached to, use GetComponent().

However, you don’t need the Collider component when you can just say:
gameObject.CompareTag(“Something here”)

What exactly are you trying to do?

Could you clarify where exactly the collider “other” is being initialized?

1- Either you have fully displayed your script here and your Collider other is null and you have to have a Null Reference Exception error in your console, during the Update (because you are trying to access to other.gameObject that cannot be found).

2- Either your script is not active on a gameobject in your scene (be sure that the checkboxes of your gameobject and of your script in the inspector are well checked).

3- Either you did not fully displayed your script here (you hide the part where you assign the other Collider to an existing Collider ont your scene) and the problem is elsewhere (maybe a inaccuracy between the string you are trying to compare and the current tag of your collider gameobject, be sure of your letter case and that your tag has to hiding space at the beginning or at the end).

Don’t hesitate to use the Debug.Log (); or the print (); methods in your script to print a message to check what part or your script is executed or not.