Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how do i make it so there is only 1 player per team ?

how do i make it so i there can only be one person per team so when they step on the spawn pad they get that team and nobody else can be on that team until they leave cinda like super hero tycoon but my game is free build with btools so i need teams so there is a plot for each team

1 answer

✓ Accepted answer

Hello, This Code Should Work.

This Is A Script

local plrs = {}
local team = game:GetService("Teams"):WaitForChild("YourTeam",3)

game.Workspace.YourPart.Touched:Connect(function(hit)
	if plrs[1] == nil and hit.Parent:WaitForChild("Humanoid", 3) then
		print("Here")
		local plr = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
		plr.Team = team
		table.insert(plrs, plr.Name)
		game:GetService("Players")[plrs[1]].Team.PlayerRemoved:Connect(function()
			table.remove(plrs, 1)
		end)
	end
end)


Hope This Helped!

This discussion is preserved as it was. New answers, comments, and votes are closed.