Syntax to reference a call function in C#

Hi, I need to access a function called playerMove from enemyAI, but I cannot for the life of me seem to find the correct syntax that actually works. I’m currently using:
//Not actually code, just the lines affected

GameObject go = GameObject.FindGameObjectWithTag("Player");

PlayerScript ps = (playerMove)go.GetComponent(typeof(playerMove));

ps.Dead();

Thank you for your help

try something like this, use your class name for CircleCollider2D

 CircleCollider2D col = gameObject.GetComponent<CircleCollider2D>();

If you have access to the class then you can call the function normally like col.playermove();

I think you’re a little confused.
I’ll try and infer as much as I can, and you tell me if I’ve missed anything.
From what I can see, you’re trying to get a component of type playerMove and assign it to your variable ‘ps’ which you’ve declared as a different type PlayerScript …not going to work. Is the script/component that your trying to access on your player a ‘playerMove’ or ‘PlayerScript’ component?

Your return type from GetComponent needs to match the variable your trying to assign it to. So depending on which component your trying to access, it will look something like —

PlayerScript ps = go.GetComponent<PlayerScript>(); // or...
playerMove ps = go.GetComponent<playerMove>();