can somebody help me figure out what's wrong with this script

i am making a scripted way to block the player from being able to return to the previous room, i have it set up so that the celling collapses but i cant figure out what’s going wrong with the script ,`i’m new to c# can someone tell me what’s wrong with this code:

    using UnityEngine;
using System.Collections;

public AudioClip rockfall;

public class trigger : MonoBehaviour{

		void Awake()
		
			GameObject go GameObject.find (FallingCellingC) 
			go.rigidbody.iskinematic = true
			
			GameObject go GameObject.find (FallingCellingB) 
			go.rigidbody.iskinematic = true
			
			GameObject go GameObject.find (FallingCellingA) 
			go.rigidbody.iskinematic = true
			
			//GameObject go GmeObject.find (TrapEnter)
		
			
			//GameObject go GmeObject.find (TrapEnter)
			
		
		// Update is called once per frame
		void Update () {
		
		if OnTriggerEnter(Collider TrapEnter) = true{
		 
	 
		GameObject go = GameObject.Find("FallingCellingC");
		go.rigidbody.isKinematic = false;
		
		AudioSource.PlayClipAtPoint(rockfall, Transform.Position);
			
		else go.rigidbody.isKinematic = true;
		
		}
		
		if OnTriggerExit(Collider TrapEnter) = true{
							
		GameObject go = GameObject.Find("FallingCellingB");
		go.rigidbody.isKinematic = false;
		
		AudioSource.PlayClipAtPoint(rockfall, Transform.Position);					
																	
		else go.rigidbody.isKinematic = true;
		
		}
		
		if OnTriggerEnter(Collider TrapExit) = true{
			
		GameObject go = GameObject.Find("FallingCellingA");
		go.rigidbody.isKinematic = false;
		
		AudioSource.PlayClipAtPoint(rockfall, Transform.Position);
		
		else go.rigidbody.isKinematic = true;
		
		 }
	 
	
	}
}

this is an updated version of the code as of 1/10/2014 using what i have learned from you guys and gals comments, there is still something wrong and the commented lines at 19 and 22 are there because i thought i might need to tell the script where to find the triggers but was unsure if it was need or will be need

Everything is wrong with this code. You should consider going back to the beginner tutorials for a while. For a long while. Your code demonstrates no understanding of the basic principles of programming. Let alone OOP.

Here is the code that will compile.

using UnityEngine;
using System.Collections;
 
public class trigger : MonoBehaviour {

    public AudioClip rockfall;

    void OnTriggerEnter(Collider TrapEnter){
         AudioSource.PlayClipAtPoint(rockfall, transform.position);
    }

    void OnTriggerExit (Collider TrapEnter) { 
         GameObject go = GameObject.Find("FallingCelling3");
         go.rigidbody.isKinematic = false;
    }    
}   

Problems fixed for you

  • Multiple incorrect braces
  • Multiple methods defined with the same signature
  • Multiple method calls with no brackets
  • Multiple instances of incorrect capitalisation (Transform and transform are two very different things)
  • No declaration for rockfall variable

Note this script will not do what you intended it to do. My changes just let it compile. You really really need the beginner tutorials.

For your function calls, review the examples in the reference. You something like:

 GameObject.Find("FallingCelling").rigidbody.isKinematic = false;

Or…

GameObject go = GameObject.Find("FallingCelling");
go.rigidbody.isKinematic = false.

Note the string for the name of the game object must be an exact match including case.

you are getting those errors because this:

void OnTriggerEnter(Collider TrapEnter);

AudioSource.PlayClipAtPoint rockfall, Transform.Position;
}

should be this:

void OnTriggerEnter(Collider TrapEnter){
  AudioSource.PlayClipAtPoint(rockfall, Transform.Position);
}

and you are missing a closing curly brace here:

void OnTriggerExit(Collider TrapExit){

GameObject go = GameObject.Find("FallingCelling2");
go.rigidbody.isKinematic = false;
} // TODO: add this curly brace in your own code!

and each of your calls to PlayClipAtPoint is missing the parenthesis.

AudioSource.PlayClipAtPoint(rockfall, Transform.Position);

Also, each

Transform.Position

should be

transform.position