function Path()
local path = game:GetService("PathfindingService"):CreatePath()
path:ComputeAsync(Character.HITBOX.Position,PartFollow.Position)
print("path")
for _, waypoint in pairs(path:GetWaypoints()) do
local part = Instance.new("Part")
print("parts")
part.Material = "Neon"
part.Anchored = true
part.CanCollide = false
part.Shape = "Ball"
part.Position = waypoint.Position
part.Parent = game.Workspace
Hum:MoveTo(waypoint.Position)
Hum.MoveToFinished:Wait()
end
end
Path()
Also the pathfinder will be unable to compute as it will collide with the parts surrounding the character. Please research “PathfindingModifiers” to mitigate this issue. Alternatively for the mean time you can delete those parts
local path = game:GetService("PathfindingService"):CreatePath()
local sucess, errorMessage = pcall(function()
path:ComputeAsync(Character.PrimaryPart.Position * Vector3.new(1,0,1),PartFollow.Position * Vector3.new(1,0,1))
end)
if sucess and path.Status == Enum.PathStatus.Success then
for _, waypoint in pairs(path:GetWaypoints()) do
local part = Instance.new("Part")
print("parts")
part.Material = "Neon"
part.Anchored = true
part.CanCollide = false
part.Shape = "Ball"
part.Position = waypoint.Position
part.Parent = game.Workspace
Hum:MoveTo(waypoint.Position)
Hum.MoveToFinished:Wait()
end
elseif sucess and path.Status == Enum.PathStatus.NoPath then
warn("No path")
elseif not sucess then
warn(errorMessage)
end