I fixed it on my own, but thanks for the support. None of the answers really helped so I made my own workaround that works perfect.
Yes, that is easy. To call something in a table you need to do something like this:
mytable = {1,2,3,4,5,6,7,8,9,1337, "Roblox"} print(mytable[10]) --Should print "1337".
Now to call the last thing in the table do this:
mytable = {1,2,3,4,5,6,7,8,9,1337, "Roblox"} print(mytable[#mytable]) --Print the 11th one since there are only 11 of them.
To do the second to last one do this:
mytable = {1,2,3,4,5,6,7,8,9,1337, "Roblox"} print(mytable[(#mytable-1)]) --Should print "1337", 11-1= 10 which is the 2nd to last one on the table.
There, that is all!
local tab = {0,1,2} for i = 1,10,1 do table.insert(tab,1,i) local last = tab[#tab] --#table returns the length of the table as an integer local secondlast = tab[#tab - 1] local first = tab[1] print(last, secondlast, first) wait(1) end