Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do i make it so there can only be one player on a team?

Asked by 4 years ago

What i mean is how can i get a script that makes it so there can only be one player on a team. I have three teams. 1. Smashers 2. Crushers 3. Destroyers

1 answer

Log in to vote
0
Answered by
qChaos 86
4 years ago

Use a PlayerAdded connection on the team and check if there is more than one person by using GetPlayers() on the team. Example:

local Team=game:GetService'Teams'.TeamName
Team.PlayerAdded:Connect(function(Player)
    if #Team:GetPlayers()>1 then
        Player.Team=nil
    end
end)
0
On top of that check which team doesn't have a player in it and put that player in it and of course don't forget limiting your max players per server to 3 players only GGRBXLuaGG 417 — 4y
0
Si i did that already. SamZeKat 28 — 4y
Ad

Answer this question