Quick script correction?

Hey there just need some quick script correction.
I’m getting two of these and i’m unsure why.

Line 62
Line 77

error CS0116: A namespace can only contain types and namespace declarations

Here is the script…

using UnityEngine;
using System.Collections;

public class PickupObject : MonoBehaviour {
    GameObject mainCamera;
    bool carrying;
    GameObject carriedObject;
    public float distance;
    public float smooth;
    public float thrust;
    // Use this for initialization
    void Start () {
        mainCamera = GameObject.FindWithTag("MainCamera");
    }
 
    // Update is called once per frame
    void Update () {
        if(carrying) {
            carry(carriedObject);
            checkDrop();
            //rotateObject();
        } else {
            pickup();
        }
    }

    void rotateObject() {
        carriedObject.transform.Rotate(5,10,15);
    }

    void carry(GameObject o) {
        o.transform.position = Vector3.Lerp (o.transform.position, mainCamera.transform.position + mainCamera.transform.forward * distance, Time.deltaTime * smooth);
        o.transform.rotation = Quaternion.identity;
    }

    void pickup() {
        if (Input.GetKeyDown (KeyCode.E))
                        GetComponent<NetworkView>().RPC("PickUp", RPCMode.All, null);
    }

    [RPC]
    public void PickUp()
     
        {
            int x = Screen.width / 2;
            int y = Screen.height / 2;

            Ray ray = mainCamera.GetComponent<Camera>().ScreenPointToRay(new Vector3(x,y));
            RaycastHit hit;
            if(Physics.Raycast(ray, out hit)) {
                Pickupable p = hit.collider.GetComponent<Pickupable>();
                if(p != null) {
                    carrying = true;
                    carriedObject = p.gameObject;
                    //p.gameObject.rigidbody.isKinematic = true;
                    p.gameObject.GetComponent<Rigidbody>().useGravity = false;
                }
            }
        }
    }

void checkDrop()

{
    if(Input.GetKeyDown (KeyCode.E))
        GetComponent<NetworkView>().RPC("dropObject", RPCMode.All, null);

    {
        dropObject();
    }
}




[RPC]
void dropObject()

{
    carrying = false;
    //carriedObject.gameObject.rigidbody.isKinematic = false;
    carriedObject.gameObject.GetComponent<Rigidbody>().AddForce(transform.forward * thrust);
    carriedObject.gameObject.GetComponent<Rigidbody>().useGravity = true;
    carriedObject = null;
}

The methods on line 62 and line 77 are outside of the class declaration, which means you are missing a closing curly brace ‘}’ somewhere in your code.

Edit: look around the method on line 42.

I put a curly on line 40 which then remove one of the
(error CS0116: A namespace can only contain types and namespace declarations)

and gave me a parsing error on line 60.

I think i’ve gotten myself lost

Thank you for the help anyways :slight_smile:

Fix it.

Had to remove like 60
and add a curly on line 86

Thank you Timelog you were a great help :slight_smile: