Arduino obstacle avoiding + bluetooth robot

Hello, Im new at arduino and I need help with my project. My obstacle avoiding robot work perfect same as bluetooth car but when I combined them together it obstacle avoiding robot dont work. It only work for second when I started him.Other things like moving forward or backward works perfect . I try everything and dont know what to do.
Here is my code:

#include <NewPing.h>
#include <Servo.h> 

char t;
const int IN1 = 7;
const int IN2 = 6;
const int IN3 = 5;
const int IN4 = 4;
const int Speed1 = 11;
const int Speed2 = 3;
const int Echo= 12;
const int Trig = 13;
const int MaxDistance = 600;

NewPing sonar(Trig, Echo, MaxDistance); 
Servo myservo;  

void setup() {
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
pinMode(Echo, INPUT);
pinMode(Trig, OUTPUT);
pinMode(Speed1 , OUTPUT); 
pinMode(Speed2 , OUTPUT); 
myservo.attach(9);  
myservo.write(90); 
Serial.begin(9600);
}

void loop() { 
analogWrite(Speed1 , 150);
analogWrite(Speed2 , 150);
if(Serial.available()){
 t = Serial.read();
 Serial.println(t);


switch(t){
 case 'S':
 digitalWrite(IN1, LOW);
 digitalWrite(IN2, LOW);
 digitalWrite(IN3, LOW);
 digitalWrite(IN4, LOW);
 break;
 case 'F': 
 digitalWrite(IN1, HIGH);
 digitalWrite(IN2, LOW);
 digitalWrite(IN3, HIGH);
 digitalWrite(IN4, LOW);
 break;
 case 'B':  
 digitalWrite(IN1, LOW);
 digitalWrite(IN2, HIGH);
 digitalWrite(IN3, LOW);
 digitalWrite(IN4, HIGH);
 break;
 case 'R':
 digitalWrite(IN1, LOW);
 digitalWrite(IN2, HIGH);
 digitalWrite(IN3, HIGH);
 digitalWrite(IN4, LOW);
 break;
 case 'L': 
 digitalWrite(IN1, HIGH);
 digitalWrite(IN2, LOW);
 digitalWrite(IN3, LOW);
 digitalWrite(IN4, HIGH);
 break;
 case 'X' :
 nenaraz();
 break; 
 case 'x' :
 digitalWrite(IN1, LOW);
 digitalWrite(IN2, LOW);
 digitalWrite(IN3, LOW);
 digitalWrite(IN4, LOW); 
}}}




 void nenaraz(){
 long duration,distance;
 int distanceR = 0;
 int distanceL =  0;
 delay(40);
 analogWrite(Speed1 , 150);
 analogWrite(Speed2 , 150);
 if(readPing()<=23){
 digitalWrite(IN1 , LOW);
 digitalWrite(IN2 , LOW);
 digitalWrite(IN3 , LOW);
 digitalWrite(IN4 , LOW);
 delay(200);
 digitalWrite(IN1 , LOW);
 digitalWrite(IN2 , HIGH);
 digitalWrite(IN3 , LOW);
 digitalWrite(IN4 , HIGH); 
 delay(300);
 digitalWrite(IN1 , LOW);
 digitalWrite(IN2 , LOW);
 digitalWrite(IN3 , LOW);
 digitalWrite(IN4 , LOW);
 delay(200);
 distanceR = lookRight();
 delay(200);
 distanceL = lookLeft();
 delay(200);

 if (distanceR>=distanceL){
 digitalWrite(IN1, LOW);
 digitalWrite(IN2, HIGH);
 digitalWrite(IN3, HIGH);
 digitalWrite(IN4, LOW);
 delay(600);
 digitalWrite(IN1, LOW);
 digitalWrite(IN2, LOW);
 digitalWrite(IN3, LOW);
 digitalWrite(IN4, LOW);
 }
 else {
  digitalWrite(IN1, HIGH);
 digitalWrite(IN2, LOW);
 digitalWrite(IN3, LOW);
 digitalWrite(IN4, HIGH);
 delay(600);
 digitalWrite(IN1, LOW);
 digitalWrite(IN2, LOW);
 digitalWrite(IN3, LOW);
 digitalWrite(IN4, LOW);
 }
 }
 else {
 digitalWrite(IN1, HIGH);
 digitalWrite(IN2, LOW);
 digitalWrite(IN3, HIGH);
 digitalWrite(IN4, LOW); 
 }
 distance = readPing();
}
int readPing() { 
 delay(70);
 int cm = sonar.ping_cm();
 if(cm==0)
 {
   cm = 250;
 }
 return cm;
}
int lookRight()
{
   myservo.write(12); 
   delay(500);
   int distance = readPing();
   delay(100);
   myservo.write(90); 
   return distance;
}
int lookLeft()
{
   myservo.write(180); 
   delay(500);
   int distance = readPing();
   delay(100);
   myservo.write(90); 
   return distance;
}

If somebody knows what to do it would help a lot.

Your issue is system integration. There's where things get one step more difficult. You've got 2 different systems working being alone. That's a very good start.
It's too late for me to analyze Your code. Use pen and paper, make drawings for the interface of the Bluetooth and the line follower and see what You can find out.