I think I finally found what’s causing my waypoints script to start messing up. At first it was a problem with the waypoints in a table not being sorted. And then someone taught me about table.sort. It was a good fix for a while until i realized it was sorting alphabetically rather than numerically. All of the waypoints are named numbers, and this is how they are sorted normally in studio (and in the script as you can see with the print). Is there a way to have a table sort these names numerically?
local waypoints = map.EnemyPaths[tostring(mob.WaypointsType.Value)]:GetChildren()
table.sort(waypoints, function(a,b)
return a.Name < b.Name
end)
for i, waypoint in pairs(waypoints) do
print(waypoint.Name)
end