void Update() { GameObject Player = GameObject.Find("Player"); healthbar healthbar = Player.GetComponent <healthbar> (); healthbar.SetHealthText(); GameObject Pistol = GameObject.Find("Pistol"); Shooting Shooting = Player.GetComponent <Shooting> (); if (currenthp <= 0) { currenthp = maxhp; Debug.Log("dead"); transform.position = new Vector3(Random.Range(1f, 99f), 0.5f, Random.Range(1f, 149f)); } }