EDIT: Fixed, see below for the lines that fixed my script:
local speed = npc.Humanoid.Running:wait()
if speed ~= 0 then repeat speed = npc.Humanoid.Running:wait() until speed == 0 end
Hi guys, I was wondering how I could check if a Humanoid arrives at a WalkToPoint set by the MoveTo function. I need this so I can begin re-moving my NPC when they arrive at their destination to give a sense of movement.
I have tried making it so it waits until the torso's X position equals the destination's X position, but this doesn't work as the Humanoid can sometimes overshoot it and be a few decimal places away from it.
Here is my current script, without waiting for the Humanoid to arrive at their destination:
local region = require(game.ServerScriptService:WaitForChild("RegionScript")) --ModuleScript that generates a random position when RandomiseLocation is called.
local paths = game.Lighting.Paths:GetChildren()
local npc = script.Parent
npc:WaitForChild("Humanoid")
npc:WaitForChild("Torso")
while true do
wait(2)
local rand = math.random(1,#paths)
local randLoc = region:RandomiseLocation(paths[rand])
print(randLoc.X, randLoc.Y, randLoc.Z)
npc.Humanoid:MoveTo(randLoc)
end
Any help is appreciated, thanks!

3 comments
http://wiki.roblox.com/index.php?title=Running they stop walking when the speed is 0.
Wow, can't believe it was that simple. Thanks!
I turned it into an answer form, you can accept it