How to make player invisible to AI pawns

I want When i press i a key i want to make my player invisible so that AI pawns cannot see my player

You could make a bool variable isInvisible and set it to true. Then make the AI attack only (or whatever it does) if isInvisible variable is false. I haven’t worked with AI but I assume it’s possible.