Use a global Lua table, and use it as a dictionary:
-- Initialize the array, this should be in a file outside of any functions -- Maps UUID -> true for all players who are currently spying g_SpyingPlayers = {} -- Add a player: g_SpyingPlayers[a_Player:GetUUID()] = true -- Remove a player: g_SpyingPlayers[a_Player:GetUUID()] = nil -- Do something with all players: for _, uuid in pairs(g_SpyingPlayers) do cRoot:Get():DoWithPlayerByUUID(uuid, function (a_CBPlayer) a_CBPlayer:SendMessage("You are spying") end ) end -- for uuid - g_SpyingPlayers[]