I have a script (from this site) but he is not good i have changed the name (TheScript) but then comes a error can anyone help me
//attach this script to your trigger
var Player : GameObject;
var Script : theScript;
function OnTriggerEnter(other : Collider) //Check if something has entered the trigger ( and declares this object in "other" )
{
if(other.collider.tag == Player.tag) //Checks if the Player is inside the trigger
{
Script = GetComponent(theScript);
Script.enabled = true; //enables theScript.
}
}
Check the name of your attached script. In your question it is “TheScript” in your sample script you call it “theScript”. Your script is case sensitive and this may stop it.
If your script’s filenanem is TheScript.js, then the script should look like this:
//attach this script to your trigger
var Player : GameObject;
var Script : TheScript;
function OnTriggerEnter(other : Collider) //Check if something has entered the trigger ( and declares this object in "other" )
{
if(other.collider.tag == Player.tag) //Checks if the Player is inside the trigger
{
Script.enabled = true; //enables theScript.
}
}