I really don't know how to fix this, I know the line it is on but no matter what I try it doesn't work! Here is a snippet of the "bad code" by the way all the rest of the code works and I also returned the module. This is a modulescript.
local mob = {}
local ServerStorage = game:GetService("ServerStorage")
local Mobs = ServerStorage.Mobs
local space = game:GetService("Workspace")
local map = space.Map
function mob.Move(mob, map)
local humanoid = mob:WaitForChild("Humanoid")
local waypoints = map.Waypoints
for waypoint=1, #waypoints:GetChildren() do
humanoid:MoveTo(waypoints[waypoint].Position)
humanoid.MoveToFinished:Wait()
end
end
