Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make an NPC walk towards a player when detected in a certain radius?

Alright, well I am working on a new Apocalypse game and I am currently working on the zombies. I need help understanding how to make the npc zombies detect a player when that player enters a certain radius of studs, lets say 20 studs for now. Once they player enters that radius of the zombie then the zombie would use path finding service and move to the player. How would i do this? Any ideas? Help is needed ASAP. Thanks for your time. Also i believe that the script would use magnitude but im not so sure. You honestly dont have to script it for me but i just need ideas how to do this. Thanks.

~AllianceScripter

2 answers

Without an exact answer, I would recommend using magnitude. It is a really easy tool if you understand it.

:) Hope this helps!

1 comment

1

Yeah, I would use a loop that constantly checks if any of the players torsos are close by using magnitude

Hmm, idk but the way that you can make a humanoid walk to a player is :

Zombie1.Humanoid.WalkTo(Vector3.new(plr.Character.Torso.Position))
plr.Character.Torso.Position.Changed:connect(function()
Zombie1.Humanoid.WalkTo(Vector3.new(plr.Character.Torso.Position))
end

This discussion is preserved as it was. New answers, comments, and votes are closed.