Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

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

Asked by 8 years ago

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

Log in to vote
0
Answered by 8 years ago

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

:) Hope this helps!

1
Yeah, I would use a loop that constantly checks if any of the players torsos are close by using magnitude QuantumToast 261 — 8y
Ad
Log in to vote
-2
Answered by 8 years ago

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

Answer this question