tm = script.Parent
function onTouched(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h ~= nil then
local n = hit.Parent
local p = game.Players:FindFirstChild(""..n.Name.."")
if p ~= nil then
p.TeamColor = tm.BrickColor
n.Humanoid.Health = 0
end
end
end
script.Parent.Touched:connect(onTouched)
local plrs = {}
local team = game:GetService("Teams"):WaitForChild("YourTeam",3)
local teams = game:GetService("Teams")
local teamList = teams:GetTeams()
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
for i, v in pairs(teamList) do
if #v:GetPlayers() == 0 then
player.Team = v
end
end
end)