How do I make a script that prevents NPC from harming players on a specific team?
Im just starting to design a game, so this is my first time scripting. I tried to use the anti team killing script along with the sword script, heres what i tried:
01 | local Player = game.Players:GetPlayerFromCharacter(hit.Parent) |
02 | humanoid = workspace.DroolingZombie |
03 | Darkgreen = game.teams.Undead |
04 | if Player.TeamColor ~ = Darkgreen then |
06 | humanoid:TakeDamage( 0 ) |
08 | untagHumanoid(humanoid) |
10 | function tagHumanoid(humanoid, Player) |
11 | local creator_tag = Instance.new( "ObjectValue" ) |
12 | creator_tag.Value = humanoid |
13 | creator_tag.Name = "creator" |
14 | creator_tag.Parent = Player |
16 | function untagHumanoid(humanoid) |
18 | local tag = Player:findFirstChild( "creator" ) |