how to end a level?

I trying to end a level but i cant find a script to use. What script should i use to end the level when the player gets to a certain point?

Assuming the player represents a physical in-world `RigidBody` and that it has the tag Player set, you can detect when it enters a trigger and then load your end level scene. Add the following code to a script attached to the trigger (`Collider`) object:

function OnTriggerEnter(other : Collider)

More information here:

dont forget to check “on trigger” button on the trigger

*if(transform.position = Bector)
var Bector : Vector3;

But make sure you put the exact name of the level and add it to the build settings.

var levelToLoad: int;

function Start(){ levelToLoad = Application.loadedLevel+1; }

function OnTriggerEnter(collider : Collider) {

if(collider.gameObject.tag == "Player"){ Debug.Log("Player collided");


the best one is

var scene: string;

funvtion OnTriggerEntr{