generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Random Line Selector?

Previous Thread :: Next Thread 
epiccolton24 is not online. epiccolton24
Joined: 25 May 2011
Total Posts: 351
02 Jan 2015 02:58 PM
How can it be programmed so that a SurfaceGUI TextLabel displays a random phrase from a select few words everytime the code that causes the phrase to appear for a small interval before going back it's normal text? (I got that part down, I just need to figure out how to make the code pick a random phrase).

If you're wondering what I am doing, I am writing a SurfaceGUI for a monitor which displays the message "-- OFFLINE --" for 15-45 seconds before flashing to a hellish message (i.e. "666" or "Hellwaits2killu") for 0.2 seconds before going back to the "-- OFFLINE --" message for another 15-45 seconds. The main thing I need help in is choosing that random hellish phrase. Can anybody point me in the right direction?
Report Abuse
SamTheDeveloper is not online. SamTheDeveloper
Joined: 16 Sep 2014
Total Posts: 194
02 Jan 2015 03:01 PM
I Can Help You With That
Report Abuse
epiccolton24 is not online. epiccolton24
Joined: 25 May 2011
Total Posts: 351
02 Jan 2015 03:08 PM
Ok, good to hear someone is willing to help, here is my code (albeit being simple for the moment):

m = script.Parent
time_wait = math.random(10, 45)

while true do
wait(time_wait)
m.Text = "666" <--- //the part I particularly need help with//
m.FontSize = Enum.FontSize.Size48
m.TextColor3 = Color3.new(0.75,0,0)
wait(0.3)
m.Text = "-- OFFLINE --"
m.FontSize = Enum.FontSize.Size24
m.TextColor3 = Color3.new(0.75,0.75,0.75)
time_wait = math.random(10, 45)
end
Report Abuse
SamTheDeveloper is not online. SamTheDeveloper
Joined: 16 Sep 2014
Total Posts: 194
02 Jan 2015 03:10 PM
number = script.number
number.Value = 0

number.Value = math.random(1, 10) -- chooses random number between 1 and 10


if number.Value == 1 then -- if number is 1 then



elseif number.Value == 2 then -- if number is 2 then



elseif number.Value == 3 then -- if number is 3 then

-- etc


end


For this script to work there has to be a IntValue In The Script Called Number.
Report Abuse
apricotdew is not online. apricotdew
Joined: 21 Aug 2012
Total Posts: 427
02 Jan 2015 03:14 PM
local phrases = {"Howdy","lol"}

while true do
ChosenPhrase = phrases[math.random(1,#phrases)]
SurfaceGuiHere.Text = ChosenPhrase
wait(5)
end
Report Abuse
epiccolton24 is not online. epiccolton24
Joined: 25 May 2011
Total Posts: 351
02 Jan 2015 03:14 PM
Ok, do I use that code to get the script to pick a random phrase?
Report Abuse
apricotdew is not online. apricotdew
Joined: 21 Aug 2012
Total Posts: 427
02 Jan 2015 03:17 PM
Yes, you can put it in another function and call it at the end of the while loop
Report Abuse
epiccolton24 is not online. epiccolton24
Joined: 25 May 2011
Total Posts: 351
02 Jan 2015 03:23 PM
@apricotdew

Your code worked the best. Thanks for the help!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image