Just a quick question about scripting in general to be more efficient. I was just testing out some code below because I was thinking of making a game with a lobby of players and then I realized that this would not print whenever a new player joins. I know that I could put the for do inside the function, but I was just wondering if there is a way to update something that is printed ever time a change occurs (without using a while loop).
activePlayer = {}
game.Players.PlayerAdded:connect(function(player)
table.insert(activePlayer, player)
end)
print("Current Players In The Server:")
for i,v in pairs(activePlayer) do
print(v)
end
I'm aware that this is not a very major question, but thank you for any replies.

1 comment
PlayerAdded is a signal that fires every time a new player joins the server. You could try putting the print statement inside there.