Hello. First thing, This is a alt account if you are wondering why the bacon hair. Other words on to the issue.
First issue.
local teams = game:GetService("Teams")
local tInfo = {
["Stalker"] = {
MaxPlayers = 1;
}
["Survivor"] = {
MaxPlayers = 9;
}
["Spectator"] = {
MaxPlayers = 10;
}
}
local function countTeam(team)
local count = 0
for _, player in next, players:GetPlayers() do
if player.Team == team then
count = count + 1
end
end
return count
end
local function assignRandomTeam(player)
local assigned = false
while not assigned do
local randomTeam = teams:GetChildren()[math.random(#teams:GetChildren())]
if randomTeam and countTeam(randomTeam) < tInfo[randomTeam.Name].MaxPlayers
then
player.Team = randomTeam
assigned = true
end
wait(.5)
end
end
Is the code i have to randomly select a player to a team. It was from a dev forum(Cant find it again). Also about how many people get in a team. When i run the command. It dose not randomize. it also gives me this error.
Workspace.Script Error 96,50 Expected ') (to close '{' at line 2),got '['
Also where do i place this. Do i keep it in the workshop or move it to a new file.
2 thing. Basically the title. i need some help creating a code that when a player joins a team they will be remodeled to a model i have.
Thank you.

3 comments
The comma's fixed the error. But for the local randomTeam. I replaced that on line 27 but it will still not do a randomize
Are you calling the function and is this a normal script
It was a normal script i changed it to a local. Still doesn't work. Im new to coding so what you you mean calling on the function.