One Script not working.

I am making a chat app with Unity and I have created two scripts one that connects with the server and the other that provides gives the chat funcionlaity. I have attached both of the scripts to my Main Camera but the problem is that only one scripts works but the other doesn’t. Please help me with a fix.
There are no errors.

Working Script :

using System.Collections.Generic;
using UnityEngine;

 public class NetworkMenu : MonoBehaviour {

	public string connectionIP = "127.0.0.1";
	public int portNumber = 9192;
public static bool connected { get; private set; }

	private void OnConnectedToServer()
	{
		connected = true;
	}

	private void OnServerInitialized()
	{
		connected = true;
	}

	private void OnDisconnectedFromServer()
	{
		connected = false;
	}

	public void OnGUI()
	{
		if (!connected)
		{
			connectionIP = GUILayout.TextField(connectionIP);
			int.TryParse(GUILayout.TextField(portNumber.ToString()), out portNumber);

			if (GUILayout.Button("Connect"))
			{
				Network.Connect(connectionIP, portNumber);
			}
			if (GUILayout.Button("Host"))
			{
				Network.InitializeServer(4, portNumber, true);
			}
		}
		else 
		{
			GUILayout.Label("Connections: " + Network.connections.Length.ToString());
		}
	}


}

Script Not working at all and not even giving a message in Logs:

using System.Collections;
using System.Collections.Generic;

public class Chat : MonoBehaviour {

public List<string> chatHistory = new List<string>();
private string currentMessage = string.Empty;

private void onGUI(){

	if (!NetworkMenu.connected) {
		return;
	}
	GUILayout.BeginHorizontal (GUILayout.Width (250));
	currentMessage = GUILayout.TextField (currentMessage);

	if (GUILayout.Button("Send")){

		if (!string.IsNullOrEmpty(currentMessage.Trim())){

			GetComponent<NetworkView>().RPC("ChatMessage", RPCMode.AllBuffered, new object[] { currentMessage });
			currentMessage = string.Empty;
		}

	}

	GUILayout.EndHorizontal();

	foreach (string x in chatHistory){
		GUILayout.Label(x);
		}
}
		[RPC]
		public void ChatMessage(string Message){

	chatHistory.Add (Message);

		}
}

Screenshot:

onGUI is not the same as OnGUI. Therefore your onGUI method is not called at all.

Keep in mind that you use the old / legacy network system (Raknet). Unity has a new one called UNet.

@yes3sir

Have you tried putting a debug.Log before return in “if (!NetworkMenu.connected)”.