Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a script that prevents NPC from harming players on a specific team?

Asked by 9 years ago

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:

01local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
02humanoid = workspace.DroolingZombie
03Darkgreen = game.teams.Undead
04if Player.TeamColor ~= Darkgreen then
05    tagHumanoid(humanoid)
06    humanoid:TakeDamage(0)
07    wait(1)
08    untagHumanoid(humanoid)
09end
10function 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
15end
View all 23 lines...
0
Please put the code in a code block YellowoTide 1992 — 9y

Answer this question