Please help me implement this new CollisonGroup to my script I am currently using the old one and I’m new to coding
Here is my code
local PhysicsService = game:GetService("PhysicsService") -- collison group part
local ServerStorage = game:GetService("ServerStorage")
local mob = {}
local map = workspace.Grassland
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
if object:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(object, "Mob") -- collison group part
end
end
coroutine.wrap(mob.Move)(newMob, map)
end
else
warn("Requested mob does not exist:", name)
end
end
return mob