Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local serverstorage = game.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
- coroutine.wrap(mob.Move)(newMob, map)
- end
- else
- warn("Requested mob dose not exist",name)
- end
- end
- return mob
Add Comment
Please, Sign In to add comment