I'm trying to make a script so when a player enters the game;
- A team will be created.
- The team's name will be the player's username.
- The colour will be random.
- Assign the player to that team.
And also it should delete the team the player was on when the player leaves. When I test it, the player joins 'Neutral'. I have a spawn there so the player spawns where I want it. When I take off neutral on the spawn, the spawn 'doesn't exist' anymore (the player doesn't spawn there)
This is what I have so far;
game.Players.PlayerAdded:connect(function(player)
local team = Instance.new('Team')
team.Parent = game.Teams
team.Name = ""..player.Name..""
team.TeamColor = BrickColor.Random()
player.TeamColor = BrickColor.new(team.TeamColor)
end)
I'm sorry for the long question/description. Answers are greatly appreciated! :)

1 comment
Did some fixes and it's coming up with an error.