Hey all! I'm new here. it's great to meet all of you.
I'm trying to make a script in which the player is being followed by a zombie, however..when I test it in game, the zombie doesn't move at all
I based this off of a tutorial that showed how to make an enemy moving script
--delcaring what torso is
local torso = script.Parent.Torso
local x = script.Parent.Humanoid
--finding t he player
function findPlayer()
for _,z in next, game.Players:GetPlayerss()do
if z.Character then
local char = z.Character
if char:FindFirstChild("Humanoid") and char:FindFirstChild("Torso") then
local ptorso = char.Torso
if (ptorso.Position - torso.Position).magnitude <=30 then
return z
end
end
end
return nil
end
end
--makes zombie follow NPC
while wait() do
local player = findPlayer()
if player ~= nil then
x:MoveTo(player.Character.Torso.Position)
else
return nil
end
end
Help would be greatly appreciated! I'm a real newbie when it comes to coding in LUA, haha.

5 comments
in game.Players:GetPlayers() you got a typo
I changed it to "GetPlayers()" removing that double s, but it seems to remain stagnant for some reason :S
Try changing the torso to UpperTorso in line 9
Thanks! Its still stationary..do the roblox bodies effect how the code operates?
Based it off or copied it?