This seems to be happening at random moments. I have made a script to make a message GUI generate random messages. The code is here.
while wait(5) do
local gui = script.Parent
local messages = {
"msg1", -- Replaced messages with example strings
"msg2",
"msg3",
"msg4"
}
local rand = math.random(0, 3)
gui.Message.Text = messages[rand]
end
As said previously, at somewhat random moments it seems to be returning the same error. Any help?
This is the correct answer, but to add on to it, you can use the # to get the length of the table, so if you change the table, then you don’t have to worry about changing the rest of the code:
while wait(5) do
local gui = script.Parent
local messages = {
"msg1", -- Replaced messages with example strings
"msg2",
"msg3",
"msg4"
}
gui.Message.Text = messages[math.random(#messages)]
end