Reading a table in a table as a number?

I have a table to store updated player data. In the main table, there are more tables named for each player, and in those tables is their updated data.

function playerModule:ValueChanged(player, value)
	print("module script")
	print(playerModule.mainModule)
	table.insert(playerModule.mainModule[player.Name], value.Name)
	task.wait()
	playerModule.mainModule[player.Name][value.Name] = value.Value ---inserts new key, name and value of whatever data is updated
	print("added to table!")
	print(playerModule.mainModule)
end
local toUpdate = table.find(moduleScript.toUpdate, player.Name)
	print(toUpdate)

^^^ I want toUpdate to print only the player’s table, inside the main table. Right now it prints “1”

1 Like

table.find returns the index at which the value was found in the table, so you can do:

print(moduleScript.toUpdate[toUpdate])

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.