making sounds very 30 seconds

Hello everyone,
Im new and a beginner at programming.
I want to use a distance sesnor and LEDs. A buzzer should make a sound every 30 seconds but without influensing the funtion of the sensor and LED. I have tried:

int pieps=6

void setup
{pinMode(pieps, OUTPUT);}

void loop
{if (millis()%500==0) (A friend suggested that to me but what does this function/sentence mean)
tone(6, 100, 1000)
else
{
digitalWrite(pieps, LOW);
}}

thanks for your help!!

The IDE has a number of examples built in.
One of them is called "blink without delay".

It is well worth studying

void setup() // note the ( and )
{
// setup code
}

void loop() // note the ( and )
{
// loop code
}

(millis()%500==0) gets the remainder of millis() divided by 500 and compares that to 0 to see if they are equal.

{if (millis()%500==0)

if the current value of millis() is exactly divisible by 500 with no remainder

Mind you, it would appear to have no relevance to what you want to do

Also

tone(6, 100, 1000)

is missing the trailing semicolon

int pieps = 6;  // note the ;