Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I want a Text Label to run through tons of text and randomly select one of those texts?

Asked by 4 years ago

I am trying to make a spinner and don't know how to get it to randomly select text.

0
do math.random VVoretex 146 — 4y

2 answers

Log in to vote
0
Answered by
VVoretex 146
4 years ago
Edited 4 years ago

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

Ad
Log in to vote
0
Answered by
zomspi 541 Moderation Voter
4 years ago

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

Answer this question