Hello, I know how to do an anti-team kill, something like this:
local hitmodel = players:GetPlayerFromCharacter(hit.Parent)
if hitmodel and (player.Team ~= hitmodel.Team) then
humanoid:TakeDamage(math.random(19,31))
end
But the problem is that I have several teams that should not cause damage to each other.
Currently, if a player from the MTF team shoots a second player from the same team, nothing happens.
But if an MTF player shoots a player from the Guards team, that player will take damage, but I don’t want this, I want the MTF team not to cause damage to the Guards team.
I don’t have ideas.
local teamlist = {["Guards"]=1, ["Default"]=1, ["Players"]=2} --Guard and Default in one team, Players in another
local hitmodel = players:GetPlayerFromCharacter(hit.Parent)
if hitmodel and teamlist[player.Team.Name]~=teamlist[hitmodel.Team.Name] then --We take damage if the team numbers are different
humanoid:TakeDamage(math.random(19,31))
end