function getTeamMembers(CGABrown) local members = {} for i,v in pairs(Game.Players:GetPlayers()) do members[#members+1] = v.TeamColor == TeamColor and v or nil end return members end function teleportTeam(BrightBlue, Position) for i,v in pairs(getTeamMembers(CGABrown)) do repeat wait() until v.Character v.Character:MoveTo(-1498.821, 12.499, -277.718) end end
The variable TeamColor
you use in the fourth line is never defined. I believe you intended it to be the parameter of getTeamMembers
. In that case, you need to pass (line 10) (instead of the nil
value CGABrown
) a BrickColor value, probably BrickColor.new("CGA brown")
.
So, here is what all of that looks like together:
function getTeamMembers(TeamColor) local members = {} for i,v in pairs(Game.Players:GetPlayers()) do members[#members+1] = v.TeamColor == TeamColor and v or nil end return members end function teleportTeam(BrightBlue, Position) for i,v in pairs(getTeamMembers(BrickColor.new("CGA brown"))) do repeat wait() until v.Character v.Character:MoveTo(-1498.821, 12.499, -277.718) end end