Code just stopped working for no reason
I got the errors
On my main script
ServerScriptStorage.Main.Mob:29: Expected identifier when parsing expression. got ‘then’
Here is my main script
local PhysicsService = game:GetService("PhysicsService")
local ServerStorage = game:GetService("ServerStorage")
local mob = {}
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
mob:Destroy()
end
function mob.Spawn(name, quantity, map)
local mobExists = ServerStorage.Mobs:FindFirstChild(name)
if mobExists then
for i=1, quantity do
task.wait(0.5)
local newMob = mobExists:Clone()
newMob.HumanoidRootPart.CFrame = map.Start.CFrame
newMob.Parent = map.Mob
for i, object in ipairs (newMob:GetDescendants()) do
object:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(object, "Mob")
end
end
coroutine.wrap(mob.Move)(newMob, map)
end
else
warn("Requested mob does not exist:", name)
end
end
return mob
And on my second script it says
Requested module experienced an error while loading
Here is my script
local mob = require(script.Mob)
local map = workspace.Grassland
for wave=1, 5 do
print("WAVE STARTING:", wave)
if wave < 5 then
mob.Spawn("Zombie", 3 * wave, map)
elseif wave ==5 then
mob.Spawn("Zombie", 100, map)
end
repeat
task.wait(1)
until #map.Mob:GetChildren() == 0
print("WAVE ENDED")
task.wait(1)
end
It says the issue it at the first line