How can I make teammates not hit each other?

I just made 2 teams on a baseplate cause ı was bored , but ı just tested with one of my friend he just hit me during he was in my team so how can ı make something that is about of teammates not hit each other?

2 Likes
if attacker.Team ~= target.Team then
    -- do damage
end
2 Likes

Can you tell me the place of this script in the explorer?

You add a check to the script that does damage to other players. Check if the team of the player that is attacking isn’t the same as the team of the player who got hit by the attack. I can’t really help you further unless you provide the code that you use to damage players

I’ve seen gun packs use a TK BoolValue (you might be able to use attributes now)

if attacker.Team == target.Team then
   if tool.TK.Value == true
      -- do damage
   end
else
   -- do damage
end

Is this works on only one tool, or if ı add this to all of the tools it will work anyways.

I know its just a suggestion if you want certain ranks to have TK

player.CharacterAdded:Connect(function()
  if player:GetRankInGroup(GroupId) > HighRankId then
    for i, v in pairs(player.Backpack:GetChildren()) do
       if v:FindFirstChild("TK") then
         v.TK.Value = true
      end
    end
  end
end)

I think he means that where do you put the script in (serverscriptservice, workspace,…)