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
 

Get max in a table?

Previous Thread :: Next Thread 
Re_el is not online. Re_el
Joined: 11 Feb 2014
Total Posts: 4394
21 May 2016 02:31 PM
local values = {
script.ChooseMaps.Map1.MapCount1.Value,
script.ChooseMaps.Map2.MapCount2.Value,
script.ChooseMaps.Map3.MapCount3.Value
}


mapchosen = math.max(values)

Is this correct?
I am trying to get the highest value.

mapcount1,2,3 are numbervalues


Youtube.com/GSSROBLOX II R$11,096
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
21 May 2016 02:34 PM
yes
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
21 May 2016 02:34 PM
math.max(unpack(values))


Report Abuse
Re_el is not online. Re_el
Joined: 11 Feb 2014
Total Posts: 4394
21 May 2016 04:16 PM
How would i find the parent of the value?
like the name of the numbervalue itself?

mapchosen.Parent.Name?

erm..




Youtube.com/GSSROBLOX II R$11,096
Report Abuse
Re_el is not online. Re_el
Joined: 11 Feb 2014
Total Posts: 4394
21 May 2016 04:19 PM
bump


Youtube.com/GSSROBLOX II R$11,096
Report Abuse
Re_el is not online. Re_el
Joined: 11 Feb 2014
Total Posts: 4394
21 May 2016 04:26 PM
ya get me?


Youtube.com/GSSROBLOX II R$11,096
Report Abuse
WoolHat is online. WoolHat
Joined: 19 May 2013
Total Posts: 1873
21 May 2016 04:27 PM
This might work, if no two numbers are the same. If they are, it's probably better to loop through each.

local CM = script.ChooseMaps
local Map1 = CM.Map1
local Map2 = CM.Map2
local Map3 = CM.Map3

local values = {
[Map1.MapCount1.Value] = Map1
[Map2.MapCount2.Value] = Map2
[Map3.MapCount3.Value] = Map3
}


mapchosen = values[math.max(values)]
Report Abuse
Re_el is not online. Re_el
Joined: 11 Feb 2014
Total Posts: 4394
21 May 2016 04:31 PM
Thanks
How would i put map1 like this?

script.ChooseMaps.MapName.Value = [The Value].Parent.Map.SurfaceGui.MapName.Text



Youtube.com/GSSROBLOX II R$11,096
Report Abuse
Re_el is not online. Re_el
Joined: 11 Feb 2014
Total Posts: 4394
21 May 2016 04:33 PM
Each value has a whole different model/parent

Im trying to find the highest value then getting that value then get its parent


Youtube.com/GSSROBLOX II R$11,096
Report Abuse
Re_el is not online. Re_el
Joined: 11 Feb 2014
Total Posts: 4394
21 May 2016 04:40 PM
is there a way?


Youtube.com/GSSROBLOX II R$11,096
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