kittyabs
|
  |
| Joined: 24 Feb 2011 |
| Total Posts: 10297 |
|
|
| 01 Sep 2013 04:46 PM |
This is for a figure that goes after anything with a Humanoid, I tried to rename my humanoid but that killed the animations and what not, so how would I make it so that this figure thing doesn't go after anyone on team "A"
-------------------------------------------------- local larm = script.Parent:FindFirstChild("Left Arm") local rarm = script.Parent:FindFirstChild("Right Arm")
function findNearestTorso(pos) local list = game.Workspace:children() local torso = nil local dist = 500 local temp = nil local human = nil local temp2 = nil for x = 1, #list do temp2 = list[x] if (temp2.className == "Model") and (temp2 ~= script.Parent) then temp = temp2:findFirstChild("Right Arm") human = temp2:findFirstChild("Humanoid") if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then if (temp.Position - pos).magnitude < dist then torso = temp dist = (temp.Position - pos).magnitude end end end end return torso end
human = script.Parent:findFirstChild("Humanoid") if human == nil then human = script.Parent:findFirstChild("Zombie") end
while true do wait(1) local target = findNearestTorso(script.Parent.Torso.Position) if target ~= nil then human:MoveTo(target.Position, target) human.TargetPoint = target.Position end
end
|
|
|
| Report Abuse |
|
your90
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 1380 |
|
| |
|
| 01 Sep 2013 04:49 PM |
| Get the player from the character and check it`s team... |
|
|
| Report Abuse |
|