Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does this model of Table Nesting & Module Scripts not work?

New to Lua and I can't for the life of me figure out tables.

local Players = game:GetService("Players")
local MasterIngamePlayerTable = require(script.Parent.MasterIngamePlayerTable)
local PlayerState = require(script.Parent.PlayerState)

Players.PlayerAdded:Connect(function(player)
	
	MasterIngamePlayerTable[player.Name] = {}
	print(MasterIngamePlayerTable[player.Name])
	MasterIngamePlayerTable[player.Name]["state"] = PlayerState
	print(game.ServerScriptService.MasterIngamePlayerTable[player.Name]["state"].test)
	
end)

I get the error [player.Name] is not a valid member of ModuleScript. Thanks for any help!

1 answer

Might be jumping to conclusions here, but the print statement was in the same environment so it was referencing the original tableless state of the module? It worked when I debugged in another script, so I'll just move on with my life.

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