Have an NPC stop walking when target is seen

image

Ive tried looking for this everywhere, but I cant seem to find out how to do this, basically I want the grey NPC to walk until the blue NPC is in sight by the grey NPC, which is the green spot

local ServerStorage = game:GetService("ServerStorage")
local SimplePath = require(ServerStorage.SimplePath)

local Dummy = script.Parent

local Goal = workspace.Main.POWERPOINT

local Path = SimplePath.new(Dummy)

Path.Visualize = true

while wait() do
	if Dummy.Parent == workspace.Defenders then
			local bluenpc = workspace.BlueNPC
		Path:Run(bluenpc.HumanoidRootPart)
	end
end

I have this code but this simply makes the grey NPC walk to the blue NPC (code uses simplepath module: SimplePath - Pathfinding Module)
any help?

2 Likes

Put this in #help-and-feedback:scripting-support.

1 Like

Oh thanks didnt realize that is was in building support

2 Likes

pathfind.rbxl (48.7 KB)
try this and see if this is what u need. (its a pathfinding dummy)

i dont recommend using simple path for current projects. Make your own tbh

1 Like