Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Editing my script to first add a team?

Asked by 8 years ago

I've made this script

function assignTeam(player, groupId, teamName) 
    if (player:IsInGroup(groupId) == true) then 
        local team = game:GetService("Teams") 
        if (team ~= nil) then 
            local team2 = team:FindFirstChild(teamName) 
            if (team2 ~= nil) then 
                if (player.Parent ~= nil) then 
                    player.TeamColor = team2.TeamColor 
                end 
            end 
        end 
    end 
end 

game.Players.PlayerAdded:connect(function(p) 
    assignTeam(p, 2676831, "Croatians")

I wan't the script to first add the team "Croatians" and then put them into it, instead of just putting them in.

0
"want" is not a contraction. 1waffle1 2908 — 8y

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

If you want to create a new team, write Instance.new("Team"), set the Name and TeamColor, and parent it to Teams.

Ad

Answer this question