I need to track the amount of people on teams to determine who wins the round, however it always says that there are zero people on the teams even if that isn't true. I double checked to make sure it was the correct colors for each team. These are not the names for the teams, however, just in case that might be the issue.
blue = 0 red = 0 while wait(1) do for _,v in pairs(game.Players:GetChildren()) do if v.TeamColor.Name == "Crimson" and v.Neutral == false then red = red + 1 elseif v.TeamColor.Name == "Cyan" and v.Neutral == false then blue = blue + 1 end end print("There are "..red.." players on the red team and "..blue.." players on the blue team.") end
New script that comes up with this error message:Workspace.HidingWin:6: attempt to call a string value
local teams = game:GetService("Teams"):GetTeams() for _, team in pairs(teams) do local players = team:GetPlayers() print("Team " .. team.Name .. " has " .. #players .. " players") if team.Name("Hiding").. #players > 0 then game.Workspace.HidingWinTestA.Value = true end end
local teams = game:GetService("Teams"):GetTeams() for _, v in pairs(teams) do local players = v:GetPlayers() print("Team " .. v.Name .. " has " .. #players .. " players") if v.TeamColor.Name == "Crimson" .. #players > 0 then game.Workspace.HidingWinTestA.Value = true end end