Rotate an object when two others collide?

I’m working on a door that shuts when the player hits a collider that’s near it. I wrote a script that doesn’t get any errors and works, but the door still wont rotate.
here is the script.

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

public class DoorClose : MonoBehaviour {

    public GameObject Trigger;
    public GameObject Door;
    public GameObject Player;
    public Transform Dooor;
    void OnTriggerEnter(Collider other)
        if (other.CompareTag("Player"))
            Debug.Log("IT WORKS!!");
            Dooor.transform.Rotate(0, 60, 0);

any help would be appreciated.

I’m not near a computer with unity installed so I can’t test this out locally but try this instead underneath the Debug.Log:


Make sure you pass a reference of the door object you want to rotate from the editor to the script.
I think that you are rotating the transform alright but you are not rotating the door game object. Try it out and let me know if that worked.