You'll need a variable to keep track of where you currently are. We'll call it index
since it's the index in the table we want to look at.
1 | local table = { 'hi' , 'there' , 'this' , 'is' , 'a' , 'message' } |
5 | script.Parent.MouseButton 1 Click:connect( function () |
However, there's something not quite right here. Once index
gets to the end of the table, you'll be indexing something outside its range! Therefore we need to decide what to do in the case. The easiest method is probably to just start back at the beginning:
01 | local table = { 'hi' , 'there' , 'this' , 'is' , 'a' , 'message' } |
05 | script.Parent.MouseButton 1 Click:connect( function () |
10 | if index > #table then |