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
 

Re: How do I Randomize a Map Chosen?

Previous Thread :: Next Thread 
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
29 Aug 2012 04:21 PM
I know how to use the InsertService so I'm gonna use that for inserting maps, but I don't know how to randomize the map chosen! Would I put:

local Map = math.random(1,20)

if Map == 7 then

--Insert the Map here.

Would that work? I bet it would, but is there a better not so highly - inefficient way? I don't really wanna make a 200 line script just for that... If that's what it takes, I'll do it, but I just wanna know if there's a better, faster way.
Report Abuse
Jayskull900 is not online. Jayskull900
Joined: 26 Nov 2006
Total Posts: 590
29 Aug 2012 04:24 PM
Put the maps into Lighting.

maps = game.Lighting:GetChildren()
for i,v in ipairs(maps) do
ma = math.random(1,20)
c = v[ma]:clone()
c.Parent = Workspace
end
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
29 Aug 2012 04:29 PM
T_T Really? You just had to skim? I said, I know how to insert maps! I was asking if there's a more efficient way! Wait... Okay, that would work, but I am not using Lighting. That generates lag. Even if I have to spend much more time writing code, I don't want my game laggy! Plus, you didn't have to give me a few lines of broken code, as I already know how to make that better, with more readability and non-broken.
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
29 Aug 2012 04:30 PM
map = *MapModel*:getChildren()[1, #*MapModel*:getChildren()]

~ Moo logic = logical logic ~
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
29 Aug 2012 04:34 PM
T_T THAT DOES NOT HELP ME!!! I SAID I NEED HELP RANDOMIZING THE MAP CHOSEN!!! I don't need any more Posts on this... I guess I kinda do have to write 200 lines of code... Not literally... Probably less than that, in reality.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
29 Aug 2012 04:38 PM
The only way is to put them in lighting, unless you put all the assetIDs of the maps in a table. Then randomly choose one of the values in the table, then use that assetID to insert a map.

-------------------------
~thedestroyer115, some of the most kind and helpful posts possible!~
Report Abuse
Jayskull900 is not online. Jayskull900
Joined: 26 Nov 2006
Total Posts: 590
29 Aug 2012 04:41 PM
..If you know so much better then us then ya go do it yourself. But our solutions are better then yours, by far. And if you can't understand my code, maybe you should study up on tables, because my code works.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
29 Aug 2012 04:43 PM
^ It does work but from some reason Dozer doesn't want to put the maps in lighting and wants to insert them.

-------------------------
~thedestroyer115, some of the most kind and helpful posts possible!~
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
29 Aug 2012 04:45 PM
Putting things in Lighting does not cause much lag.

¤¤ †KMXD† ¤¤ [SHG Tier~3] [Freelancing Scripting Guru] •д•
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