I'm creating a script whereas only one player can be in a specific team via a team switching GUI (presumably a click button one). I want to make the limit "one", and if there's already one player occupying that spot, no one else can join that team, no matter how hard they click the team switching button for it. In case you're wondering, here's some details:
Team Name = Border Inspector
Team Color = Reddish brown
This is the current script for the team switching GUI:
player = game.Players.LocalPlayer
function Click(mouse)
script.Parent.Sound:Play()
if player.TeamColor == BrickColor.new("Reddish brown") then
return nil
else
player.TeamColor = BrickColor.new("Reddish brown")
wait()
player.Character.Humanoid.Health = 0
end
end
function MouseLeave()
script.Parent.ImageLabel.ImageTransparency = 0
script.Parent.Words.Visible = false
end
function MouseEnter()
script.Parent.ImageLabel.ImageTransparency = 0.5
script.Parent.Words.Visible = true
end
script.Parent.MouseButton1Click:connect(Click)
script.Parent.ImageLabel.MouseLeave:connect(MouseLeave)
script.Parent.ImageLabel.MouseEnter:connect(MouseEnter)
I want to add in an command that will prevent a player from switching to that team if another player occupies that spot. I'll be so grateful. Thanks.

1 comment
Much obliged!