i managed to fix it,
i realised that i made the table called mob, and in the script i set the collision group to mobs
can you show the final 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 = workspace.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.Parent = map.Mob
for i, object in ipairs(newMob:GetDescendants()) do
if object:IsA("BasePart") then
PhysicsService:CollisionGroupSetCollidable("Mob", "Mob", false)
object.CollisionGroup = "Mob"
end
end
coroutine.wrap(mob.Move)(newMob, map)
end
else
warn("Mob could not be found!", name)
end
end
return mob
1 Like
change coroutine.wrap(mob.Move)(newMob, map)
to task.spawn(mob.Move, newMob, map)
because it is faster (at least from what i’ve heard)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.