GetPlayers
Returns a table of all connected players (server ID’s).
Syntax
GetPlayers()
Examples
for _, playerId in ipairs(GetPlayers()) do
local name = GetPlayerName(playerId)
print(('Player %s with id %i is in the server'):format(name, playerId))
-- ('%s'):format('text') is same as string.format('%s', 'text)
end
Last modified May 22, 2020: Added example to GetPlayers() function (9544a29)