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: Could I please get some help

Previous Thread :: Next Thread 
IDKBlox is not online. IDKBlox
Joined: 05 Apr 2013
Total Posts: 1304
13 May 2016 05:08 PM
okay I want to do a round script...

is there a way I can use this

GameModes={Original,New Gamemode,and so on}

loop here to go trough the game modes?"

then

if ChosenGamemode == "Original then
do this
elseif ChosenGamemode=="New Gamemode" then
do this
end

Is there a Way I can do this? if so can someone explain how please :)

Thank you very much :)
Report Abuse
IDKBlox is not online. IDKBlox
Joined: 05 Apr 2013
Total Posts: 1304
13 May 2016 05:09 PM
or is there a way I can make a remote function using this or something lol.. Thanks
Report Abuse
IDKBlox is not online. IDKBlox
Joined: 05 Apr 2013
Total Posts: 1304
13 May 2016 05:22 PM
Wait I think I figured it out... Can someone please explain how I can loop through this

local Maps = {
"Test",
"Test2",
}

and choose a random one

Thanks :)
Report Abuse
sparker22 is not online. sparker22
Joined: 11 Mar 2010
Total Posts: 846
13 May 2016 05:24 PM
Elements in a table are indexed from 1 to the number of elements. They are numerical unless specified otherwise. The most common method to loop through a table is a generic loop.

for i,v in pairs(Maps) do
-- i is the index, v is the value
end

To select a random map just generate a random number between 1 and the number of elements in a table. (#Maps would return that) and access the table with the number being the indexed.

local SelectedMap = Maps[math.random(1,#Maps)]
Report Abuse
IDKBlox is not online. IDKBlox
Joined: 05 Apr 2013
Total Posts: 1304
13 May 2016 05:33 PM
Thanks! Which one of those would you prefer to use while me using a table
using

Maps={}
Report Abuse
sparker22 is not online. sparker22
Joined: 11 Mar 2010
Total Posts: 846
13 May 2016 05:35 PM
Getting a random map, use the math.random() approach.

You should only iterate through a table when you need to compare every value against something or manipulate every value.
Report Abuse
IDKBlox is not online. IDKBlox
Joined: 05 Apr 2013
Total Posts: 1304
13 May 2016 05:38 PM
Will take that into consideration... Thank you very much for the help!
Report Abuse
IDKBlox is not online. IDKBlox
Joined: 05 Apr 2013
Total Posts: 1304
13 May 2016 05:52 PM
another quick question... Is there a way to make event:FireServer(Map) work in a script in the workspace?
Report Abuse
iJacobness is not online. iJacobness
Joined: 20 Jan 2014
Total Posts: 4944
13 May 2016 06:07 PM
Depends how it is setup. Only players can fire the server, I'm pretty sure.


r+://393244197r+://393244224r+://393244262
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