function getPlayersOnTeam(teamColor)
local players = {};
for i,v in pairs(game.Players:GetPlayers()) do
if (v.TeamColor.Name == teamColor) then
table.insert(players, v);
end end return players end;
game:GetService("RunService").RenderStepped:connect(function()
hn = #getPlayersOnTeam("Bright blue");
sn = #getPlayersOnTeam("Dark stone grey");
end)
I want this code to work in a Script, not a LocalScript. How would I make it work? [I want the code to work so that it constantly updates the count of players on each team]

2 comments
yes it is. So how do i run it from a server script?
Then use .Stepped instead of .RenderStepped.