getting gui error you can only call functions from inside OnGui.

I am getting the following error when i execute this script . plz help!:-

You can only call GUI functions from inside OnGUI.
UnityEngine.GUIUtility.CheckOnGUI () (at C:/BuildAgent/work/aeedb04a1292f85a/artifacts/EditorGenerated/GUIUtility.cs:229)
UnityEngine.GUI.get_skin () (at C:/BuildAgent/work/aeedb04a1292f85a/artifacts/EditorGenerated/GUI.cs:54)
UnityEngine.GUILayout.Label (System.String text, UnityEngine.GUILayoutOption options) (at C:/BuildAgent/work/aeedb04a1292f85a/artifacts/EditorGenerated/GUILayout.cs:17)
flap.OnGUI () (at Assets/scripts/flap.cs:61)
flap.OnCollisionEnter2D (UnityEngine.Collision2D other) (at Assets/scripts/flap.cs:28)


 using UnityEngine;
    using System.Collections;
    public class flap: MonoBehaviour
    public void OnGUI () 
    		Debug.Log ("ok");
    		GUI.color = Color.white;
    	    GUILayout.Label (" Score: " + score.ToString ());

As far as I’m aware, the OnGUI() function is just like Update(), as in you don’t need to call it. It will call itself whenever the internal unity magic happens. Stop calling it, everything should fix itself.