Answered by
5 years ago Edited 5 years ago
Okay, first, make a RemoteEvent called TeamChange and put it into ReplicatedStorage. Next, make your Team(s) and put them into game > Teams. Then, insert a LocalScript into your TextButton and type this:
01 | local btn = script.Parent |
02 | local event = game.ReplicatedStorage.Events.TeamChange |
04 | local team = game.Teams.Team |
06 | btn.MouseButton 1 Click:Connect( function () |
07 | local plrsInTeam = team:GetPlayers() |
08 | if #plrsInTeam < maxPlayers then |
09 | event:FireServer( "Team Name" ) |
11 | btn.Text = "Team Full!" |
13 | btn.Text = "Team Name" |
Do the same for other text buttons that change teams. After that, insert a script into ServerScriptService and type this:
01 | local event = game.ReplicatedStorage.Events.TeamChange |
02 | local team 1 = game.Teams.Red |
03 | local team 2 = game.Teams.Blue |
05 | event.OnServerEvent:Connect( function (plr, team) |
06 | if team = = "Team1 Name" then |
08 | elseif team = = "Team2 Name" then |
If you want more teams just copy the
1 | elseif team = = "Team2 Name" then |
part and change the team name. If you're having trouble, I made a model to help out: https://web.roblox.com/library/4467443496/Team-Change-Gui
Hope this helps!