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 get the largest of the table?

I've been confused while trying to make a script that picks the biggest number in a table

local table = {50,12,78}
for i,v in pairs(table) do
	--what do i do here?
end

1 answer

✓ Accepted answer

Try this:

local table = {50,12,78}
local highest = 0


for i,v in pairs(table) do
    if v > highest then
highest = v
end
end

2 comments

0

Thanks

0

table.sort is better

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