Hello, I have this 1 script that I am having a hard time configuring. I need it to be formatted to support a "Zombie" humanoid rather than a "Humanoid" humanoid. I have tried to change out certain parts, yet it made the model stuck. Any chance of help would be greatly appreciated!
1st Script
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 = 20
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("Torso")
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
function Hit(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
human.Health = human.Health -0
end
end
larm.Touched:connect(Hit)
rarm.Touched:connect(Hit)
while true do
wait(0.1)
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
script.Parent.Zombie:MoveTo(target.Position, target)
end
end

3 comments
By stuck, do you mean it's not moving to the target, or it cannot move at all?
Yes, its not moving at all.
You did not create this code; I have seen it before (ROBLOX's older AI NPCs). Please attempt to create the code first. :P Also, does the NPC have an 'Animate' by any chance? Because, once I created my own code for this purpose, but, it didn't move at all until I added an 'Animate' to the NPC. :P