I have script that is called PlayerCollision and when player collides with something tagged object Obstacle and in PlayerCollision I call FindObjectOfType().EndGame(); and in this function I call FindObjectOfType().restartScore();
You probably need to have a pointer to the instantiated object that has the script you’re referencing. In general, you can reference variables from one script to the other if you know the memory address of the target script/variable. You do this with pointers. For instantiated objects, you can use something like GameObject _newEnemy = Instantiate(…); This way the new object will get instantiated, but the script that caused it to be created also has a pointer to that object (_newEnemy). If the variable in that object was set to public, you could access it by typing _newEnemy.publicVariable .