I want to have anti-teamkill on the basic roblox swords but also with some teams that can’t be killed by sword.
It doesn’t seem to work at all with the immortal teams.
I have looked at A LOT of places for solutions.
Code:
function IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor or Player.TeamColor == game.Teams.Engraved.TeamColor or Player.TeamColor == game.Teams.Guest.TeamColor)
end
Needs more information. What are the “immortal teams”? Other than teammates who is this script supposed to leave unharmed? Seems like what you’ve got going on here is a case of lack of parenthesis and confusion about how and & or operators work.
Right; and what is Player defined as? Your whole evaluation either comes down to Player1 and Player2 being on the same team or Player (unnumbered) being on the Engraved/Guest teams. Is this intentional? I think a lot more detail needs to be provided especially in the way of who’s what.
Consider using either Player1 or Player2 instead of just Player to determine presence on the immortal teams. Depending on who’s getting passed as arguments to the function, Player2 (if that’s the player being attacked) should be checked for their presence on the immortal teams.
I didn’t make the script, it was just a basic roblox sword model. (And yes I checked for potential viruses.) Although this gives me some more specific things to look for.