Hi I've been trying to make this humanoid walk to each of these waypoints but whenever its at a turn or its going to the last waypoint, it just doesn't touch them for no reason. Can anyone help please?
local unit = script.Parent
local humanoid = unit:FindFirstChild("Humanoid")
local waypoints = game.Workspace.Waypoints
local currentWaypoint = 1
humanoid.MoveToFinished:Connect(function(success)
if success and currentWaypoint < #waypoints:GetChildren() then
currentWaypoint += 1
end
humanoid:MoveTo(waypoints[currentWaypoint].Position)
end)
humanoid:MoveTo(waypoints[currentWaypoint].Position)