Script is not finding number of players in a team

  1. What do you want to achieve? Keep it simple and clear!
    I am trying to find the number of players in a certain team.

  2. What is the issue?
    When there is at least 1 player in a certain team, it is supposed to print “Despacito”. This is just for a test, because finding a number of players in other aspects is not working at all either.

  3. What solutions have you tried so far?
    I tried googling other methods of finding a number of players in a team, but none of them worked.

I also tried this, which works, but only works for printing, which is confusing.

local teams = game:GetService("Teams")
local playersSpectating = teams["Vibers"]:GetPlayers()

Here is the script which is not working:

while true do
	if #playersSpectating > 0 then

If anyone could help solve this problem, it would be much appreciated! :slight_smile:

1 Like

GetPlayers(), similar to GetChildren() only gets a list of the children once. So you’re taking the number of players from the same point in time. You need to move the call to GetPlayers() to inside your loop.


Okay okay thank you so much!!!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.