The title is self explanatory, i want to know how i can make a team that can only have one player at a time.
To join the team, the player needs to touch a part, if the team is empty then that player will join the team, else if there is someone already in it they can’t join.
After the player that was on the team dies or leaves, (i already have a script that changes the player’s team once they die) when the team is empty, it is joinable, that way making it so there can only be one player in the team.
local part = nil
local team = nil
local pplayer = game:GetService("Players"):GetPlayerFromCharacter(touch.Parent)
if pplayer ~= nil and #team:GetPlayers() == 0 then
pplayer.Team = team
This script checks when a player has touched variable part and tries to add them to team if it is empty.
Both local variables at the top will need to be changed for the script to work properly.