How to call functions from another script c# (Unity5)

I want to call a function from script A to script B I tried watching a bunch of youtube videos and unity answers posts but none of them worked.

From what I can understand of your question is that you want to call a function on instance X of script A from instance Y of script B. First of all you need to have a reference to the instance. You can get this by Script A myInstance = myGameObject.GetComponent<Script A>(); where myGameObject is the gameobject on which the instance you want to use is (this only works for scripts that inherit MonoBehaviour!).

If both scripts are attached to the same gameobject you can just use gameObject.GetComponent<Script A>();.

After that it’s quite simple: myInstance.myFunction();

It should be noted that the function has to be a public function!

It would really help if you actually post your code and what you have actually tried doing.