Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a teleport based on the team name not team color?

I've looked up how to make a teleport based on team name but couldn't find any only team color seen here.

local teamColor = BrickColor.new("Really red") --Set the teamcolor here
local thePosition = Vector3.new(0,0,0) --Set the vector here
for i,v in pairs(game.Players:GetPlayers()) do
    if(v.TeamColor == teamColor) then
        v.Character:MoveTo(thePosition)
    end
end

What should I change to make it for team name?

1 answer

TeamColor must be unique. Teams are indexed/assigned by colour rather than by name. For this reason doing it by colour is better as people could risk making the assumption that teams can share a colour.

Regardless, Player has a Team property which contains an instance of the team they are in, so if we change line 4 to:

if(v.Team.Name == "NameOfTheTeam") then

It should work for checking team names :-)

This discussion is preserved as it was. New answers, comments, and votes are closed.