how to make relay stay on for x amount of second after button is pressed?

hello!

I need some help, I've played around with relays before with Arduino but now I need the relay to stay on for say, 10 seconds after the button is pushed and then have the relay turn off. I want to integrate this with my 128x64 OLED display, I want it to say "relay on" when the button is pressed, then after that it will go back to a waiting screen

here is my code for the waiting screen:

#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>

// OLED display TWI address
#define OLED_ADDR   0x3C
Adafruit_SSD1306 display(-1);

#if (SSD1306_LCDHEIGHT != 64)
#endif

void setup() {
  // initialize and clear display
  display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
  display.clearDisplay();
  display.display();
  
}

void loop() {
 
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(30,0.9);
  display.print("Waiting");
  
  display.display();
  delay(1000);
  display.clearDisplay();
    
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(30,0.9);
  display.print("Waiting.");
  
  display.display();
  delay(1000);
  display.clearDisplay();
  
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(30,0.9);
  display.print("Waiting..");
  
  display.display();
  delay(1000);
  display.clearDisplay();
  
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(30,0.9);
  display.print("Waiting...");
  
  display.display();
  delay(1000);
  display.clearDisplay();

  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(30,0.9);
  display.print("Waiting....");
  
  display.display();
  delay(1000);
  display.clearDisplay();

}

i need help with the relay code and actually integrating the two.

but the thing is all I need is the relay code that triggers with the push of a button and then I need my waiting screen code changed so that when I push a button it will display the "relay on" for 10 seconds.

I know how to have one button trigger two arduinos, so im using a nano to control the screen and an uno for the rest of the project.

I want them separate because this is part of a bigger project and the screen code has tons of delays in it so I don't want that conflicting with the rest of the project

Have a look at the button example; it demonstrates how to control a LED using a button; there is no difference between controlling a LED and a relay.

Also have a look at the state change detection example; you often want to do something when the button becomes pressed or becomes released, not when it is pressed or is released.

The state change detection example uses short delays; you can study the debounce example to prevent the use of it and combine it with the the principles of the state change detection example.

You don't need delays in your screen code. Read
Using millis() for timing. A beginners guide
Demonstration code for several things at the same time