How to make my OnTriggerEnter() and Exit work

I have been working on this code with help from a different question for the past few days and i have gotten amazing results thanks to the people of this community. Now i reach out with this code again but with a different question. I have the OnTriggerEnter() and OnTriggerExit() functions coded accurately to my knowledge and all the required systems are set up so that when my player walks through a trigger the code activates, but when testing it that is not the case, can anyone help me figure out whats wrong with my code pelase?

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

public class KeyPad: MonoBehaviour {
	//public variables
	public Texture2D icon;
	public string SetPassword = "12345";
	public string PlayerPassword = "";
	public bool KeyPadEnabled = false;
	public bool DoorIsOpen = false;
	public Transform target;
	//trigger used to enable gui elements when player enters trigger zone
	void OnTriggerEnter (Collider other) {
			KeyPadEnabled = true;
	//trigger used to disable gui elements when player enters trigger zone
	void OnTriggerExit (Collider other) {
			KeyPadEnabled = false;
			if( DoorIsOpen == true)
				target.Translate (Vector3.back *150* Time.deltaTime);
	//gui function
	void OnGUI () {
		//check if gui elemnts should be shown.
		if(KeyPadEnabled == true)
			//display gui elemnts
			GUI.Box (new Rect (10,10,300,300), new GUIContent(icon));
			PlayerPassword = GUI.PasswordField (new Rect(60, 60, 200, 35), PlayerPassword, "*"[0],45);
			//check for player input
				//check passwords
				if(PlayerPassword == SetPassword)
				//translate targer and set control variable to true
				target.Translate (Vector3.forward *150* Time.deltaTime);
				DoorIsOpen = true;


again any and all help would be much appreciated. thank you

Have you tried putting Debug.Log statements in the OnTriggerEnter/Exit functions? If they fire, but it’s just never identifying the object as the Player, then assuming you set everything up properly in the inspector, your problem is this:

Strings are considered objects, not primitives. Therefore, the == operator compares memory addresses, and not the value of the strings. Unless you are explicitly looking to see if one string object is the same as another string object (and not just whether the two strings hold equivalent values), you should be using .Equals() instead.

I see 3 places where you should replace this in your code.

Once each in OnTriggerExit/Enter


and once where you compare your passwords