Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can you create a math.random and the random number would be inserted in a TextLabel?

I have already created the math.random function and now I would like to know how you can insert that random number into a Textlabel

1 answer

✓ Accepted answer

I'm not quite sure what you mean. Do you want the TextLabel's text to be only that number, or add on to the existing text?

Here is solution #1 (Making the number the only text):

local num = math.random(1,3)
textLabel.Text = num

Now, if you want to add the number on to text that was already there, this is equally as simple.

local num = math.random(1,3)
textLabel.Text = textLabel.Text..num

By adding the two dots to the end, you are telling the script 'Hey, i want to add more stuff!'

I hope this helped you!

This discussion is preserved as it was. New answers, comments, and votes are closed.