Need help getting two scripts to communicate

I’m trying to build a simple project where the player can drop an item onto another object and have that add one point to their score.

I have a player script with a score int and an object with a collider, who’s script has an OnTriggerEnter command in it.

I just need help getting them to communicate.

Thanks.

It often gets set up something like this. So your Player object is tagged as Player as a way to tell if it is the Player object which entered the trigger collider. Then you just have it call a method on a script on the Player object.

void OnTriggerEnter(Collider col)
{
    if (col.gameObject.CompareTag("Player"))
    {
        Debug.Log("Player entered trigger");
        col.gameObject.GetComponent<ScriptOnPlayer>().MethodOnScriptOnPlayer();
    }
}

Hey, thanks for the quick reply.
I’m still getting errors.

I’ll just post my scripts here.

4285015–383737–Collection.cs (772 Bytes)
4285015–383740–PlayerScript.cs (490 Bytes)

You’re going to need to mention what those errors are if you want help with them.