|
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 02 Jan 2015 03:14 PM |
| Ok, do I use that code to get the script to pick a random phrase? |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 02 Jan 2015 03:23 PM |
@apricotdew
Your code worked the best. Thanks for the help! |
|
|
| Report Abuse |
|
|