I am trying to make a script that lets players join different teams depending on what groups they are in that are linked to the game Script:
local User = script:WaitForChild("Username")
local Regiment = script:WaitForChild("Division")
game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)
spawn(function()
wait(.8)
local c = User:clone()
local b = Regiment:clone()
a.Adornee = Character:WaitForChild("Head")
a.TextLabel.Text = Player:GetRoleInGroup(6000579)
a.Enabled = true
a.Parent = Character
b.Adornee = Character:WaitForChild("Head")
b.TextLabel.TextColor3 = (Player.TeamColor.Color)
b.Enabled = true
b.Parent = Character
c.Adornee = Character:WaitForChild("Head")
c.TextLabel.TextColor3 = (Player.TeamColor.Color)
c.TextLabel.Text = Player.Name
c.Enabled = true
c.Parent = Character
Character:WaitForChild('Humanoid').NameOcclusion = Enum.NameOcclusion.OccludeAll
local h = Character.Head:Clone()
local m = Instance.new('Model',Character)
m.Name = 'NameTag'
h.Parent = m
Character.Head:WaitForChild('face'):Destroy()
Character.Head.Transparency = 1
local w = Instance.new('Weld',Character.Head)
w.Part0, w.Part1 = Character.Head, h
end)
end)
end)
I can't seem to figure out where to add the part where it switches your team so I do not know if I am using a script that doesn't work or if I am putting it in the wrong place.
