How to count players with a particular tag
Posted: Fri Mar 23, 2018 5:06 pm
This command print that tag = nil
Code: Select all
/c game.print(#game.players.tag['[Tag]'])
www.factorio.com
https://forums.factorio.com/
Code: Select all
/c game.print(#game.players.tag['[Tag]'])
Code: Select all
local count = 0
for _,player in pair(game.players) do
if player.tag == 'whatever' then
count = count +1
end
end
game.print(count)
Yes it works fine, thanks!eradicator wrote:(untested)Code: Select all
local count = 0 for _,player in pair(game.players) do if player.tag == 'whatever' then count = count +1 end end game.print(count)