AllPlayersInGame is a table
And you're trying to call it, and it has no __call metamethod, and will thus error. Simply removing the parenthesis () will fix it.
Player is a misleading identifier for your variable that contains the Players service. It is not referring to a specific player, but the players service. Also, your table will not update if a player joins or leaves.
Finally, do not use while wait(t) do ... end. This is not a good idiom to follow. It only works because of a hack; a trick.
Use
while (true) do
end
It's clearer.
local Players = game:GetService("Players");
while (true) do
for _, client in ipairs(Players:GetPlayers()) do
print(client);
end
wait(1);
end
4 comments
I don't know if this will help because I never did anything like that. But see what happens when you remove the "()" from from "AllPlayersInGame".
Remove the parentheses in Line 9 on pairs(AllPlayersInGame())
Yes, you should remove the parenthesis. AllPlayersInGame is a table, not a function. GetPlayers() returns a table.
Also, "tostring(v.Name)" is unnecessary because Name itself is a string.