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

How to Make Textlabel Lines Randomized?

Asked by 4 years ago
Edited 4 years ago

I'm making a loading screen and I'm wondering how I can randomize the text lines to play. So, here's the code.

local GUI = script.Parent
local Message = GUI:WaitForChild("MessageText")

local Messages = {  "Preparing Waffles",
    "When I was a pre-text, I was told to not go for the bat!",
    "I gotta say, these will be fun. Just don't get too much fun.",
    "Watch your step!",
    "Let's see the bestest guest that will never make no regrets!",
    "Armor gives you health. If you're in trouble, drink potions too!",
    "Time to show what's done.",
    "I remember when I was also a pre-text, I loved being the announcer for baseball games!",
    "Your expedition to take revenge for those newbies!",
    "Guests are just guests, but this one is not like other guests!",
    "Like Guest Quest? Join Payday's Studios for free armor.",
    "You know that quote don't judge a book by its cover? Well, not really these newbies.",
    "Eat, Sleep, Play Guest Quest!",
    "You know why this is limited? I wish I was never a script!",
    "Want a code? Our current codes are: OPEN. Redeem them for something special"
    }


1 answer

Log in to vote
0
Answered by 4 years ago
math.randomseed(tick())

local randomMessage = Messages[math.random(1,#Messages)]

This will choose a random number between 1 and the amount of messages you have, and then index the message table with that number and that message will be chosen. So, randomMessage is one of the messages from the table.

Hope this helped!

Ad

Answer this question