--note this is a script inside the model It does not work in the actual game just in studio I tried making it a localscript didn't work

local distance = 500
players = nil; --Where we are going to store all the players
dummy = game.Workspace.Berserker; --Dummy reference
currentPlayerFollowing = nil; --The current player the zombie is following

while wait(1) do --Forever loop
 players = game.Players:GetChildren(); --Grab all the Players currently in the game
 
 for i = 0, table.getn(players), 1 do --Go through all of the players
  if (players[i] ~= nil and (math.abs(players[i].Character.UpperTorso.Position.X - dummy.UpperTorso.Position.X)) <= 10) then --Subtract the distance between the player and the zombie
   currentPlayerFollowing = players[i]; --Add the player to the currentPlayerFollowing reference so the zombie can follow them
  end
 
 if (currentPlayerFollowing ~= nil) then --If the player is there
    dummy.Humanoid.WalkToPoint = currentPlayerFollowing.Character.UpperTorso.Position --Walk to the player
 end
end
end

2 comments

0

Please use code block then I can answer.

0

Werid.. i couldve sworn i did