Team:GetPlayers() always returns an empty array!

For some reason, even though players are on the team, Team:GetPlayers() always returns an empty array!

Code?? Errors??? Need more information

local playingPlrsBlue = game.Teams.BLUE:GetPlayers()
local playingPlrsRed = game.Teams.RED:GetPlayers()

When I print these, in the output it’s just an empty array!

for i,v in pairs(game.Players:GetPlayers()) do
			local team = teams[math.random(1, #teams)]
			v.Team = team
			if v.Team == teams[1] then
				sample:FireAllClients("blue", v.Name)
			else
				sample:FireAllClients("red", v.Name)
			end
		end

teams is just a table holding both of the teams and you don’t need to worry about the client
There is also no errors. The making players go onto a team bit works

If you’re defining playingPlrsRed/Blue at the top of the script, then it will run before any players join. Move it into the function or wherever you’re using it or it will never update.

It works, thanks! [char limit]

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