Moving the dummy from A to B is fine, however how would I move the dummy back to A afterwards?
local Patrol_Delay = 5
local function Activate2WayPoints(key) -- the key is the name of the dummy
local StartPosition = NPCFolder.Guard[key..""].HumanoidRootPart.Position -- Create start and end
local EndPosition = NPCFolder.Waypoints[key.."_B"].Position
local Path1 = PathfindingService:CreatePath() -- Create path
Path1:ComputeAsync(StartPosition, EndPosition)
local waypoints = Path1:GetWaypoints()
for _, waypoint in pairs(waypoints) do -- Loop through waypoints
local part = Instance.new("Part")
part.Shape = "Ball"
part.Material = "Neon"
part.Size = Vector3.new(0.6, 0.6, 0.6)
part.Position = waypoint.Position
part.Anchored = true
part.CanCollide = false
part.Parent = game.Workspace
NPCFolder.Guard[key..""].Humanoid:MoveTo(waypoint.Position)
NPCFolder.Guard[key..""].Humanoid.MoveToFinished:Wait()
end
end
while wait(Patrol_Delay) do -- Loop through a folder containing multiple dummies
for _,Guards in pairs(Level1Folder.NPC.Guard:GetChildren()) do
Activate2WayPoints(Guards.Name)
end
end