Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a script that gets the biggest value on a table?

I think the title says it all, I need a script that creates a table with numbers and picks the highest value of that table.

1 answer

✓ Accepted answer
local randomOrder = {
	0,5,6,23,43,23,2,2153,2,5
}
local largest = 0
for _, v in pairs(randomOrder) do
	if v > largest then 
		largest = v
	end
end
print(largest) -- 2153

just assigning largest to the other largest... checking if each number is greater than each other...

Click accept if this helps, thx

4 comments

0

Thanks alot bud!

0

OH SWEET 3 UPVOTES!!! Also, you are welcome

0

Forgot to accept answer, oops.

0

it's ok

This discussion is preserved as it was. New answers, comments, and votes are closed.