Help my script plz!

using UnityEngine;
using System.Collections;
using Sfs2X;
using Sfs2X.Core;
using Sfs2X.Requests;
using Sfs2X.Entities;

public class NetworkingClient : MonoBehaviour {

private string host = “localhost”; //The ip the client tries to connect to
private int port = 9933; //The port the client tries to connect to the server on

public SmartFox _client;

// Use this for initialization
void Start () {
_client = new SmartFox ();
_client.ThreadSafeMode = true;
_client.AddEventListener(SFSEvent.CONNECTION, OnConnection;
Connect ();
}

// Update is called once per frame
void FixedUpdate () {
_client.ProcessEvents();
}

public void Connect() {
_client.Connect (host, port:);
}

void OnConnection(BaseEvent _event) {
if((bool)_event.Params[“success”]) {
//Successful
Debug.Log (“Successfully connected to server”);
} else {
//Failed
Debug.Log (“Failed connecting to server”);
}
}

Whats wrong with my script please help me guys! :frowning:

_client.AddEventListener(SFSEvent.CONNECTION, OnConnection;

You are missing a bracket at the end of that line. Maybe that’s your problem…

can you plz put it in my sript and send me the whole script… I feel really retarded now :frowning:

It’s in the Start()-function:

// Use this for initialization
void Start () {
  _client = new SmartFox ();
  _client.ThreadSafeMode = true;
  _client.AddEventListener(SFSEvent.CONNECTION, OnConnection);  // <--- This bracket was missing
  Connect ();
}

I am still getting this error

Assets/_Scripts/Networking/NetworkingClient.cs(41,1): error CS8025: Parsing error

using UnityEngine;
using System.Collections;
using Sfs2X;
using Sfs2X.Core;
using Sfs2X.Requests;
using Sfs2X.Entities;

public class NetworkingClient : MonoBehaviour {

    private string host = "localhost"; //The ip the client tries to connect to
    private int port = 9933; //The port the client tries to connect to the server on

    public SmartFox _client;

    // Use this for initialization
    void Start () {
        _client = new SmartFox ();
        _client.ThreadSafeMode = true;
        _client.AddEventListener(SFSEvent.CONNECTION, OnConnection);
        Connect ();
    }

    // Update is called once per frame
    void FixedUpdate () {
        _client.ProcessEvents();
    }

    public void Connect() {
      _client.Connect (host, port:);
    }

    void OnConnection(BaseEvent _event) {
        if((bool)_event.Params["success"]) {
          //Successful
          Debug.Log ("Successfully connected to server");
        } else {
          //Failed
          Debug.Log ("Failed connecting to server");
        }
    }
}

You were missing a curly bracket at the end of the script.

In order to identify these problems quickly you should try to keep your code well formatted.