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 » Scripting Helpers
Home Search
 

math.random(), any ideas?

Previous Thread :: Next Thread 
JusticeLym is not online. JusticeLym
Joined: 07 Oct 2011
Total Posts: 261
05 May 2013 05:21 PM
Maps = {"Test1","Test2","Test3","Test4","Test5"}
while wait(600) do
Map = script:FindFirstChild(math.random(#Maps))
if Map then
Map.Disabled = false
end
end

Trying to make it choose a random map, I've found that when testing it uses numbers, any way to make it use lets say, Test1 instead of 1?
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
05 May 2013 05:24 PM

Map = script:FindFirstChild("Test"..math.random(#Maps))
Report Abuse
JusticeLym is not online. JusticeLym
Joined: 07 Oct 2011
Total Posts: 261
05 May 2013 05:27 PM
Anyone better methods to where every model/script has to be named the same thing with a number after it?
Report Abuse
JusticeLym is not online. JusticeLym
Joined: 07 Oct 2011
Total Posts: 261
05 May 2013 05:30 PM
Any* -Bump-
Report Abuse
funnymouse7 is not online. funnymouse7
Joined: 17 Mar 2011
Total Posts: 1741
05 May 2013 05:31 PM
make variables?
or do if's like this

a = math.random(1,3)

if a == 1 then
--your script here
end

if a == 2 then
--your script here
end

if a == 3 then
--your script here
end

a bit long but convenient
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
05 May 2013 05:39 PM
btw, If you're going to use a table you could also do:

Maps = {"Test1","Test2","Test3","Test4","Test5"}
while wait(600) do
Map = script[Maps[math.random(#Maps)]]
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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