How do I make text disappear and be replaced by other text

Hey guys, I’m working on a game and I’m wanting to have a guy talking in the background to distract you, but I’m wanting to use text and not sound. I don’t want to just have a huge line of really tiny words above him so I was wondering if there is any way to make text disappear and have other text take it’s place.

@J-la Put your text in a table and display one entry after the other. You can control the speed at which each entry is shown. You can put as many or as few words in each entry.

@J-la Here’s an example.

displayMode(FULLSCREEN)

function setup()
    rectMode(CENTER)
    tab={}
    table.insert(tab,"Hey guys, I'm working on a game")
    table.insert(tab,"and I'm wanting to have a guy talking")
    table.insert(tab,"in the background to distract you,")
    table.insert(tab,"but I'm wanting to use text and not sound.")
    table.insert(tab,"I don't want to just have a huge line")
    table.insert(tab,"of really tiny words above him")
    table.insert(tab,"so I was wondering if there is any way")
    table.insert(tab,"to make text disappear")
    table.insert(tab,"and have other text take it's place.")
    xx=1
    cnt=0
    fontSize(30)
end

function draw()
    background(40, 40, 50)
    fill(255)
    rect(WIDTH/2,HEIGHT-100,600,50)
    fill(255,0,0)
    text(tab[xx],WIDTH/2,HEIGHT-100)
    cnt=cnt+1
    if cnt>180 then
        cnt=0
        xx=xx+1
        if xx>9 then
            xx=1
        end
    end
end

@J-la If you don’t want to create a table, you can put the text in a string and display it. In this example, you can set the number of words to show and the number of seconds between displays.

EDIT: Modified the code below.

displayMode(FULLSCREEN)

function setup()
    rectMode(CENTER)
    str="Hey guys, I'm working on a game and I'm wanting to have a guy talking in the background to distract you, but I'm wanting to use text and not sound. I don't want to just have a huge line of really tiny words above him so I was wondering if there is any way to make text disappear and have other text take it's place."    
    fontSize(30)
    cnt=9999
    str2=""
    st=0
    words=7
    seconds=1
end

function draw()
    background(40, 40, 50)
    fill(255)
    rect(WIDTH/2,HEIGHT-100,600,50)
    fill(255,0,0)
    text(str2,WIDTH/2,HEIGHT-100)
    cnt=cnt+1
    if cnt>seconds*60 then
        cnt=0  
        readString()     
    end
end

function readString()
    str2=""
    c=0
    st=st+1
    for en=st,#str do
        v=string.sub(str,en,en)
        if v==" " then
            c=c+1
            if c>=words then
                str2=string.sub(str,st,en)
                st=en                 
                return              
            end
        end
    end 
    str2=string.sub(str,st,#str) 
    st=0
end

THANK YOU SO MUCH!!! I literally had no idea how to do it.