Make text disappear and appear after some time

Hi, i’m using this code to display random text for players.
The question is, is it possible to make text disappear after 10 seconds and then appear with random text?


local hints = { -- table of options 
    "Random text 1",
    "Random text 2"
}

local current = math.random(#hints) -- index of currently displayed text from the table

local function newRandom() -- function to change current text to some other random entry
    local old = current -- prevent same items from being chosen twice in a row
    while current == old do
        current = math.random(#hints)
    end
end

timer.Create("My Hints", 50, 0, newRandom)

local function drawText() -- function to actually draw our text
    draw.DrawText(hints[current])
end

hook.Add("HUDPaint", "My Hints", drawText)

Don’t use while, it will crash the game, add your hook when you need to draw it and use hook.Remove to remove it from drawing

no it won’t

Mind explaining why?

Going to need some clarification on this.

It’ll only crash if the randomly chosen hint is the same as the last hint over a large number of iterations. As long as the size of the hint array is more than 1, it should be near impossible to crash the game.

There is no need to create two threads for the same problem? You got an answer in your last thread??