So, I have a basic system to spawn a mob at the desired point, but for some reason when he can appear it does not go, but for example, the other model (Zombie) is going. As I understand the problem is in the model itself. If anything, here are two scripts on spawning and movement. Also, screenshots of the situation, as well as a file and Zombie mobs:
local mob = require(script.Mob)
local map = workspace.map
for wave = 1, 5 do
print("WAVE STARTING:", wave)
if wave < 5 then
--print("1")
mob.Spawn("Zombie", 3 * wave, map)
--print("2")
elseif wave == 5 then
mob.Spawn("Zombie", 100, map)
end
repeat
task.wait(1)
until #map.Mobs:GetChildren() == 0
print("WAVE ENDED")
task.wait(1)
end
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:GetChildren()[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.Parent = map.Mobs
newMob:PivotTo(map.Path.Start.CFrame)
coroutine.wrap(mob.Move)(newMob, map)
end
else
warn("Requested mob does not exists:", name)
end
end
return mob
Working Model.rbxm (8.3 KB)
Not a Working Model.rbxm (17.6 KB)