DontDestroyOnLoad problem?

when i re-load the level that this originates on it creates a duplicate and im not sure how to stop it from doing that. any ideas? and checking for this on load to delete it it only deletes it when i start to test.

using UnityEngine;
using System.Collections;

public class Variables : MonoBehaviour {
	
	private static GameObject Player;
	
	public static int num = 0;
	public static int RN;
	public static bool randEncounter = true;
	public static bool inBattle = false;
	public static int BattleRangeMin = 1;
	public static int BattleRangeMax = 20;
	public static int Exp = 0;
	public static Vector3 playerPosition;
	public static Vector3 positionAfterBattle;
	public int loop = 0;
	public static bool Win = false;
	
	//public static
	 void Awake(){
	
	DontDestroyOnLoad(this.gameObject);

	}
		

		
	

	
	// Use this for initialization
	void Start () {
		randEncounter = true;
		inBattle = false;
	

		
	}
	
	// Update is called once per frame
	void Update () {
		
		///Debug.Log();
		
		//playerPosition = GameObject.Find("First Person Controller").transform.position;
		
		///playerPosition = Player.transform.position;
		
		
		
		if(inBattle){
				
			if (loop <= 0){
				
				playerPosition = GameObject.Find("First Person Controller").transform.position;
				
				
				//positionAfterBattle = playerPosition;
			
				loop = loop + 1;
			
				if(loop == 1){		
					
					
						
				}
			}
		}
		
		if(Win){
				Application.LoadLevel("script testing");
				
				Player = GameObject.Find("First Person Controller");
				
				transform.position = positionAfterBattle;
				
				RandomEncounterScript.myState = RandomEncounterScript.battleStates.FreeRoam;	
				
				inBattle = false;
				
				randEncounter = true;
			
			
			Win = false;
		
	}
}
}

What are you trying to do?

It seems that the scene already contains the character, and you also have it to not get destroyed when you are loading the level, which leads to what you are describing.

this is a game controller script. i have my main level which this starts out on and when i go into a random battle it keeps this with all the stats and everything. but when the battle is over it loads the main level back it is supposed to keep this game object. but its also loading the game game object since it also begins in that scene. i need it to not load this again.

something that could work is if i spawn this gameobject from another script and it it detects it then it doesnt load it again. but im not sure how to do this.

…nvm i got it all figued it out… i did what i suggested i should do… i just looked up how i would do it…