Here's how it would look otherwise.
local messages = {"hello","hi","hey"}
local time = 5000
function pickMessage()
local whatMessage = math.random(1,#messages)
return messages[whatMessage]
end
function outputRandomMessage()
local message = pickMessage
outputChatBox(message)
end
function resourceStart()
setTimer(outputRandomMessage,time,0)
end
addEventHandler("onResourceStart", resourceRoot, resourceStart)
That's an overly unnecessary way to do it essentially