I am trying to make a spinner and don't know how to get it to randomly select text.
COMMUNITY QUESTION
I want a Text Label to run through tons of text and randomly select one of those texts?
2 answers
For this, use math.random
wait(3) local a = math.random(1,3)
if a == 1 then script.Parent.Text = "1"
elseif a == 2 then script.Parent.Text = "2"
elseif a == 3 then script.Parent.Text = "3" end
Try this:
local words = {separate,each,word,with,a,comma,test,word,bean}
-- spinner activate line here e.g script.Parent.MouseButton1Click:Connect(function()
local selectedword = math.random(1,#words)
script.Parent.Text = words[selectedword]
Try that
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
do math.random