Players.PlayerAdded:Connect(function(Player)
local Table = {}
table.insert(Table[Player], {})
end)
i want the table to print something like this { [Player 1] = {}, [Player 2] = {} }
but i’m not sure how to do so correctly without overriding it when new player joins
when i do table.insert(Table, Player) it sets the player as the value and not index
Two problems. The first is that you can’t create dictionaries with table.insert. Table[Player] = {}
The second is that you just need to move local Table to the outside of the event.
local Table = {}
Players.PlayerAdded:Connect(function(Player)
Table[Player] = {}
end)
Doing this will create a new key for the dictionary, and make the value an empty table. If said player already exists, then you can edit the value to something else.