Adding many people to a Team

Hello everyone, so I was making a Team Script, that adds people in a list to a certain team in-game. But it doesnt work, I was wondering if someone could help me.

Thx

Heres the script:

1 Like

Can I see the error? I need to understand what is going wrong with the script.

1 Like

You need the id for best results.

3 Likes


There is no error concerning the script

1 Like

Yeah, like @Dev_Carlitox said, use the playerID.

1 Like

Hello Showy19!

I think the key you are looking for is table.find.

local allowedplayers = {
	"arccitecc",
	"Showy19"
}
game.Players.PlayerAdded:Connect(function(player)
	if table.find(allowedplayers,player.Name) then
		player.Team = game.Teams.Police
	else
		player.Team = game.Teams.EMS
	end
end)
4 Likes