As the title says, Im trying out tables as I don’t really use them much but I am now. I tried looking on google and Youtube for support of ways I could do this but I cannot. This is what I just worked out but it clearly doesn’t work.
If you know a way I could do this or fix it so it matches up with my code, that would be wonderful!
local LoadingNames = {
"Loading Systems",
"Loading Workspace",
"Loading Players",
"Getting modules"
}
local TweenText = PlayerGui:WaitForChild("LoadingScreen").Background.Text1
local Variable = LoadingNames[math.random(#LoadingNames)]
for i = 11, 0, -1 do
task.wait(0.3)
TweenText.Text = Variable
task.wait(0.3)
TweenText.Text = Variable
end
You are picking Variable and then running the loop, Variable is outside of the loop and so it never changes. Switch these two lines around. You need to run this top line again whenever you want to pick a new random table entry.
It doesn’t make a difference, math.random substitutes 1 as the first argument when given only one argument.
math.random only returns integers unless you run it with no arguments, so no need to do that.