On Trigger Enter, Collide with object, specific collision

In a game I am writing I want to create “safe zones” and theses are like beacon towers (which having a sphere around them which are a trigger). I want the player to be able to run through them but the monster cant.

I have tried things like, when the player enters a bool variable sets true so player is safe, then the ai script doesnt run because they are safe, when they leave it goes to false and the monster can chase after them again, but that does not work. I have tried to switch off the AI script when the Player enters the Trigger but that doesnt work either.

So is there a way I can have specific collision, so the player can run through a OnTriggerEnter or a OnCollisionEnter but the monster cannot?

I have tried and looked at:


None of these work for me.

TL;DR I want my player to be able to move to a place where the monster cant.
(Only knowledge in C# can use Java if I must but rather C#)