Whenever pathfinding choses 4th point it just breaks and i dont know why
the pathfinding code
function Pathfinding(To)
local Pathfind = pathfindingService:CreatePath({AgentRadius = 5,AgentHeight = 2,AgentCanJump = false,})
Pathfind:ComputeAsync(body.Position, To)
local waypoints = Pathfind:GetWaypoints()
if Debug.Value == true then
print(waypoints)
for i,v in pairs(waypoints) do
local Sphere = Instance.new("Part",workspace)
Sphere.Size = Vector3.new(.6,.6,.6)
Sphere.Anchored = true
Sphere.CanCollide = false
Sphere.Material = Enum.Material.Neon
Sphere.Shape = Enum.PartType.Ball
Sphere.Position = v.Position
game.TweenService:Create(Sphere,TweenInfo.new(7,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{Size = Vector3.new(0,0,0)}):Play()
game.Debris:AddItem(Sphere,7)
end
end
for k, waypoint in pairs(waypoints) do
humanoid:MoveTo(waypoint.Position)
if waypoint.Action == Enum.PathWaypointAction.Jump then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
humanoid.MoveToFinished:Wait()
end
Moving = false
end
output after 4th
{}