✓ Accepted answer
Players is a table, not a player. So when you print it, you'll get something like this: table: 1A1D9D00
You actually don't need the extra table at all.
for i, v in pairs(game.Players:GetPlayers()) do
if v.Character then
print(v)
end
end
But wait! This doesn't help, because you're trying to learn about table.insert. So let's fix your original code, even though that's not something you'd want to do in a real situation.
local Players = {}
for i, v in pairs(game.Players:GetPlayers()) do
if v.Character then
table.insert(Players, v.Name)
end
end
for i, v in pairs(Players) do
print(v)
end
2 comments
Did not print.
If it's running as soon as the game starts, it will run before anyone joins, therefore not printing. Just delay it a bit.