Create Team Upon Player Joining

I want to make it so that upon a player joining, a team is created and that player is assigned to that team by themselves. Friends will be invited to join the team with a separate gui/script. I’ve got the team creation part down with a remote event, but I’m wondering how I can make this more efficient. Here’s the script so far.

local newTeam =“Team”)
newTeam.Parent = game.Teams

newTeam.AutoAssignable = false
newTeam.Name = "TeamOne"

Player.Team = newTeam
local array = {10, 40}



Those arrays are me racking my brain to figure out how to implement tables, as I’m thinking that I can apply some kind of variable/table system but I’m not exactly sure how I would go about it.

If the team is being creating when a player join why are you using a RemoteEvent instead of just connecting to the PlayerAdded event in the Players Service? That would be more efficient since you said you’re handling other players joining / being invited to the team separately.


You know, I actually did have the team just get created once a player joined, but I wanted to be fancy and add a remote event which is connected to a play button. I guess I’ll revert it.

I mean thats fine, as long as your creating the team from an event. (server)