Getting Number of Members with particular role

Hello! As described above, I'm trying to determine the number of members in my server of a particular role. I've got the following code, but for some reason .members keeps returning an empty map.
const staff_role_count = oldMember.guild.roles.cache.get(roles.Staff).members.size;
const staff_count_channel = client.channels.cache.get(
voice_channels.Staff_Count
);
staff_count_channel.edit({ name: "Staff: " + staff_role_count });
const staff_role_count = oldMember.guild.roles.cache.get(roles.Staff).members.size;
const staff_count_channel = client.channels.cache.get(
voice_channels.Staff_Count
);
staff_count_channel.edit({ name: "Staff: " + staff_role_count });
Do you know what's going wrong?
Console.log(oldMember.guild.roles.cache.get(roles.Staff).members)
Console.log(oldMember.guild.roles.cache.get(roles.Staff).members)
results in an empty map, and the value of staff_role_count gets set to 0
2 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Tyranasaurus
Tyranasaurus2y ago
AH! thank you How can I do this, synctactically?