local players = {}
game.Players.PlayerAdded:Connect(function(player)
if not players[player] then
table.insert(players,player)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
table.remove(players,player)
end)
you should make a for loop function that will loop through our table, then it will return the players one by one if needed, or you can make it like to run your player based lines in the function and once it’s done with it can process the code for the rest of the players
Actually I’m not sure about this, I have a question. How is there two maps for both the players/clients? In the gyazo gif you sent, there is only one map but it prints two different maps in the output. We only get to see a server camera view and partially a client view.
so a table can handle a lot of data within, but it doesn’t reference anything directly.
with a for loop we can loop through our table’s data and return or use them, here’s an example:
local players = {game.Players.RandomPlayer}
for index,value in pairs(players) do
local character = value.Character or value.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
if humanoid then
humanoid.Health = 0
end
end
this will loop through our table and kill any player inside of it