This isn't working, could someone explain to me what I need to do? It would help me learn tables + randomizing.
local mS = game.StarterGui.ScreenGui.Frame.TextLabel local textmS = { "Hello", "Hi", "Nice to meet you", "!!", "Running out of things to say" } while true do mS.Text = textmS.Random() wait(10) end
I get what you're trying to do but you're doing it wrong.
I don't know if the function "Random()" exists, but I suggest you use math.random()
local mS = game.StarterGui.ScreenGui.Frame.TextLabel local textmS = { "Hello", "Hi", "Nice to meet you", "!!", "Running out of things to say" } while wait(10) do local WhichTablePartion = math.random(5) -- We use 5 because there are five values stored in the table mS.Text = textmS[WhichTablePartion] end
Tested and works.
Link please familarize yourself a little bit more before using these features
I noticed several problems starting with the first line that you are trying to change StarterGui, if you want to affect the player's screen it must be in the PlayerGui (and a localscript), secondly you aren't referencing the table at all with "Random"...if you would like to understand tables more then you can read this
Random is just used to select a random number, getting the actual "random text message" is just using the table index based off the number Random provided
local mS = script.Parent.TextLabel local textmS = { "Hello", "Hi", "Nice to meet you", "!!", "Running out of things to say" } while true do local random = Random.new():NextInteger(1, #textmS) mS.Text = textmS[random] wait(10) end