I have a team GUI which appears whenever a player joins the game or the player selects it himself by a button. I have certain teams that require a maximum amount of players to make the game fair. I don’t know how I’m supossed to do this.
I have tried to google search it, but I didn’t find anything proper. I asked a scripter I know but he also didn’t know what to do. I hope anyone can find a solution or some help to this issue.
Hello!
I would use something similar to what Qin said.
Once you have the team number, all you have to do is write an if-then-else bracket. Inside a Button function.
Like so:
local YourButton = YourTeamsButton
local Team = YourTeam
YourButton.MouseButton1Click:Connect(function()
local PlayersOnTeam = Team:GetPlayers()
local SentenceGui = YourTextLabel
if #PlayersOnTeam < 6 then -- The value of players you want replaces the six here.
game.Players.LocalPlayer.Team = Team
else
SentenceGui.Visible = true
--This will show only when the amount of players on a team is greater or equal to six.
end
end)