How to disable first person controller in Starter Assets - First Person Character Controller with another script

I imported Starter Assets - First Person Character Controller to my project. In game with my PressKeyReadLetter.cs script, when I click “E”, I want the player to stop moving. In another script, when I click “I”, my inventory pops up but player keeps moving. When I use my mouse, both cursor moves on inventory screen and player camera rotates. I don’t want it to happen. I tried to use:

GameObject.Find("Player").GetComponent<FirstPersonController>().enabled = false;

but I get an error in Unity :

“Assets\Scripts\PressKeyReadLetter.cs(47,56):
error CS0246: The type or namespace
name ‘FirstPersonController’ could not
be found (are you missing a using
directive or an assembly reference?)”

How can I access the FirstPersonController.cs or what is the proper way to do it? All answers I found from before 2020, so I couldn’t find any recent way.

I have the same problem and i cant fix it!! If someone help it would be awesome

Hello. First make sure that you’ve added:
using StarterAssets;

And then check the name which you try to find. It should be the exact one to which you’ve attached FirstPersonController script. For example by default it can be PlayerCapsule like in my case (I’m using Starter Assets - First Person Character Controller with minimum changes):

GameObject.Find("PlayerCapsule").GetComponent<FirstPersonController>().enabled = false;

Hope this helps