--< variables >--

local pathService = game:GetService("PathfindingService")

local slave = workspace["Slave 1"]

local humanoid = slave.Humanoid

local finish = workspace.Finish

local one = workspace.one

local path = pathService:CreatePath()

--< compute the path >--

path:ComputeAsync(slave.HumanoidRootPart.Position, one.Position)

local waypoints = path:GetWaypoints()

--< looping through the waypoints >--

for _, waypoint in pairs(waypoints) do
	
	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
	
	-- Move zombie to the next waypoint
	humanoid:MoveTo(waypoint.Position)
	-- Wait until zombie has reached the waypoint before continuing
	humanoid.MoveToFinished:Wait()
	
end

This is the script from the roblox dev hub and i dont know why it doesnt work When i run it it only creates one sphere and the npc doesnt move to it

1 comment

0

Don't you want it to go to the variable finish, instead of one? I feel the reason it is only making one ball because it think it has already arrived.