-
What do you want to achieve? Keep it simple and clear!
So i was removing collision between mobs by setting collision group. -
What is the issue? Include screenshots / videos if possible!
For some reason i get an error. I was doing that by the vid and in vid everything fine, but im getting a error
3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? Yeah i watched youtube for solution
My code:
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.HumanoidRootPart.CFrame = game.Workspace.Tunnel.Shadow1.CFrame
NewMob.Parent = game.Workspace.MobFolder
for i, object in ipairs(NewMob:GetDescendants()) do
if object:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(NewMob, "Mob")
end
end
coroutine.wrap(mob.Move)(NewMob, map)
end
else
warn("Mob doesn't exist:", name)
end
end
return mob