problems with the code

I do not know how to program my arduino, so that together with the potentiometer the servo moves and the led light turns red for degrees greater than 120 and less than or equal to 180, green for more than 60 and less than or equal to 120, and blue for grades below 60. So far I have this part of the code, but it doesn't work

#include <Servo.h>

Servo mYServo;

int potpin = 0;

int val;

void setup()
{
// put your setup code here, to run once;

Serial.begin(30);
pinMode (5, OUTPUT);
pinMode (6, OUTPUT);
pinMode (7, OUTPUT);
miServo.attach(9);
}

void loop()
{
// put your main code here, to run repeatedly;
val = analogRead(potpin);
val = map(val, 0, 1023, 0, 180);
miServo.write(val);

if ( val>120; && val<180; or val==180)

{
//RED
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
miServo.attach(9);

}
if (val>60; && val<120; or val==120)

{

//BLUE
digitalWrite(5,LOW);
digitalWrite(6,HIGH);
digitalWrite(7,LOW);
miServo.attach(9);

}
if ( val < 60; or val == 60);
{

//GREEN
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,HIGH);
digitalWrite(4,LOW);
}
delay(30);

Your if statement syntax is completely broken. Remove the semicolons.
Also the semicolon after this one, makes it ignore the code block after it, so it will always be executed:

if ( val < 60; or val == 60);

Basically, you have to learn C code syntax.

Also you should not be running miServo.attach() in loop().

it doesn't work

Does it even compile?

Please remember to use code tags when posting code

Please read How to use this forum - please read. - Installation & Troubleshooting - Arduino Forum, specifically point #7 about posting code.

ana5647:
int potpin = 0;

It should be: int potpin = A0;

pin 0 is used for Serial. You should not use pin 0.

See Arduino - Potentiometer Triggers Servo Motor tutorial

IoT_hobbyist:
It should be: int potpin = A0;
pin 0 is used for Serial. You should not use pin 0.

For readability it's probably better for OP's potpin to be A0 rather than 0, but it's not wrong.

If you have...

val = analogRead(0);

... analogRead() knows that's an analog input not the digital Serial pin.

Apart from the issues already noted, why does pin 4 mysteriously appear for the green light? (Seems there's an rgb led on pins 5,6 & 7).

//GREEN
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,HIGH);
digitalWrite(4,LOW); ??????????