I’ve got my anti teamkill script here, but it’s not very efficient. I made it like this because I have multiple teams that are friendly to each other. I wanted to know if there was a better way of doing this?
local safeTeams = {
{
"Chaos Insurgency",
"Class-D"
},
{
"Ethics Committee",
"Mobile Task Force | Epsilon-11"
},
{
"Ethics Committee",
"O5 Council",
},
{
"Ethics Committee",
"Science Department"
},
{
"Ethics Committee",
"Security Department"
},
{
"Mobile Task Force | Epsilon-11",
"O5 Council"
},
{
"Mobile Task Force | Epsilon-11",
"Science Department"
},
{
"Mobile Task Force | Epsilon-11",
"Security Department"
},
{
"O5 Council",
"Science Department"
},
{
"O5 Council",
"Security Department"
},
{
"Science Department",
"Security Department"
}
}
local friendly = false
local target = game.Players:GetPlayerFromCharacter(humanoid.Parent)
for _,tbl in pairs(safeTeams) do
if table.find(tbl, target.Team.Name) and table.find(tbl, player.Team.Name) then
friendly = true
print("No teamkilling!")
break
end
end
if not friendly then
humanoid:TakeDamage(7)
end