i need help on making a limit on how many people can be on a team. im new to scripting and im wondering if anyone could put the code in for me so i can copy it.
i have two teams, one is labeled Murderer and one is named Innocent. i would like 1 person on each team and for it to be random on which one they get. please and thank you.
I think this is what you're looking for let me know I'll try to help.
local team1playercount = game.ReplicatedStorage.numbervalue -- name of the numbervalue local team2playercount = game.ReplicatedStorage.numbervalue -- name of the second numbervalue local teamlimit1 = 1 -- change the limit to whatever local teamlimit2 = 1 -- change the limit to whatever game.Players.PlayerAdded:Connect(function(player) local team = math.random(1,2) if team == 1 then if team1playercount.Value ~= teamlimit1 then team1playercount.Value = team1playercount.Value + 1 player.TeamColor = BrickColor.new("Really red") -- change color to the first teamcolor else if team2playercount.Value ~= teamlimit2 then team1playercount.Value = team1playercount.Value + 1 player.TeamColor = BrickColor.new("Really red") -- change color to the second teamcolor else print("Both teams are full!") end end elseif team == 2 then if team2playercount.Value ~= teamlimit2 then team1playercount.Value = team1playercount.Value + 1 player.TeamColor = BrickColor.new("Really red") -- change color to the second teamcolor else if team1playercount.Value ~= teamlimit1 then team1playercount.Value = team1playercount.Value + 1 player.TeamColor = BrickColor.new("Really red") -- change color to the first teamcolor else print("Both teams are full!") end end end end)