|
| 21 Jun 2016 09:06 AM |
So to be more clear, I have a function that identifies all children using f = obj:GetChildren(); for x = 1,#f do.....
Say all the children are NumberValues and I want to count all of them and see which value is the highest of the children. How would I go about doing this?
I was thinking about math.max but I can only seem to do a single argument at a time, plus I wouldn't know how to retrieve the value's parent once one is found. |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2016 09:09 AM |
you can use other ways, this is just mine
local HighNum = nil
for i,v in ipairs(f) do if HighNum and v > HighNum then HighNum = v print(HighNum) elseif HighNum == nil then HighNum = v end end
|
|
|
| Report Abuse |
|
|
|
| 21 Jun 2016 09:11 AM |
table = {} for num,val in pairs(model:GetChildren()) do table.insert(table,1,val.Value) end print(table.sort(table))
r+://393244197r+://393244224r+://393244262 |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2016 09:14 AM |
print(math.max(table.unpack(t)))
|
|
|
| Report Abuse |
|
|
|
| 21 Jun 2016 09:23 AM |
| So I got the script to properly identify the maximum value, now my only question is how do I find which NumberValue it came from. |
|
|
| Report Abuse |
|
|