Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Retrieving data from table then using that data to access another table doesn't work?

Asked by
Cuvette 246 Moderation Voter
6 years ago

So basically I have a script that grabs a game mode randomly from a tab;e e.g.

Games = {"Gamemode1","Gamemode2"}

That's all fine but when one of those game modes has been grabbed from the table, I then have another table for each mode containing more information e.g.

Gamemode1 = {"Gamemode1 Instructions","Gamemode1 Points"}

And now, I'm trying to access the game mode table using a string given from the games table, i'm doing it like this

Choice = Games[math.random(#Games)]
Instructions = Choice[1]
Points = Choice[2]

All I get returned is nil, I've tried converting the choice to a string first, any help would be appreciated, thanks.

Answer this question