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)