I’m trying to see how many players are on a team to work in a function, but I can’t even get the amount of players in that team. I’m trying to get a single value of the number of players in a certain team.
This is what I am currently working with:
local team = game:GetService("Teams")["Next Fighter..."]
local players = team:GetPlayers()
game.Players.PlayerAdded:Connect(function()
while wait(0.5) do
print(#players)
end
end)
Even if somebody is on the team is still prints 0, can somebody help with this?
You immediately get the amount of players in the team so no matter what it’ll always be the amount of players when the variable was set, just change your code around to this and it should work
local team = game:GetService("Teams")["Next Fighter..."]
game.Players.PlayerAdded:Connect(function()
while wait(0.5) do
print(#team:GetPlayers())
end
end)