I tried this
local list = {} list.tostring(game.Players:GetChildren()[1].Name) = "Good" print(list)
and it gave me an error Workspace.Script:2: Expected identifier when parsing expression, got '=' How would I get a players name on that table? NOTICE:The server is only a single player server so if you were asking me to use localscript, here is my awnser back.
Hey Mate, Since it's a 1 player game, you could insert them into the table, when they join the game!
local list = {} game.Players:PlayerAdded:Connect(function(player) table.Insert(list, player.Name) end)
If you want to add the Player itself, just remove the .Name
Easy
local plrs = {} for i, player in pairs(game.Players:GetPlayers()) do if player then table.insert(plrs,player) end end
Nevermind I found how to set a named variable in a list, you may close this now. I may as well say that all the awnsers posted here did not tell me how to set a nammed variable in the list. My code:
local list = {} wait() list[game.Players:GetPlayers()[1].Name] = "Hi" print(list)
Well, too late to reply.