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
It turns out it was actually some other code in a different line it was: coroutine.wrap(mob.Move)(mob.Move) and the 2nd parameter of coroutine.wrap was meant to be (newMob, map).