How do I make a humanoid follow players and not other humanoids?
Heres a script I found
01 | local larm = script.Parent:FindFirstChild( "Left Arm" ) |
02 | local rarm = script.Parent:FindFirstChild( "Right Arm" ) |
04 | function findNearestTorso(pos) |
05 | local list = game.Workspace:children() |
13 | if (temp 2. className = = "Model" ) and (temp 2 ~ = script.Parent) then |
14 | temp = temp 2 :findFirstChild( "Torso" ) |
15 | human = temp 2 :findFirstChild( "Humanoid" ) |
16 | if (temp ~ = nil ) and (human ~ = nil ) and (human.Health > 0 ) then |
17 | if (temp.Position - pos).magnitude < dist then |
19 | dist = (temp.Position - pos).magnitude |
29 | local target = findNearestTorso(script.Parent.Torso.Position) |
31 | script.Parent.Humanoid:MoveTo(target.Position, target) |
It follows npcs as well as players. How can I make it only follow players? I have tried inserting "if blah:IsA("Player") but it didnt work. - Thanks