I want people to be able to switch teams and while it works, it doesn't stop people from unbalancing the teams, how do I make it so it stops people from joining teams larger than theirs.
function Click(mouse) script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Dark orange") end script.Parent.MouseButton1Down:connect(Click)
while true do wait(10) -- Delay of how many seconds it will start again for i, v in pairs(game.Teams["White Team"]:GetPlayers())do -- change "White Team" To where you will get your players from to another team v.Character.Head:Destroy() -- Resets the player instantly wait(0) -- 0 seconds to how this script will repeat again end end
It works, But not might be a switcher ( Put the script in ServerScriptService )
If you are doing a Team Changer gui script then ( Adding Spawn's is your decision )
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() player.TeamColor = BrickColor.new("Lime green") -- Change Lime Green to your team's color player:LoadCharacter() end)