SetPartCollisionGroup is deprecated, please use BasePart.CollisionGroup instead

so basically i get this warning when i put in this script. ive never used collision groups so i have no idea what this means:
07:06:32.188 SetPartCollisionGroup is deprecated, please use BasePart.CollisionGroup instead. More info: Updates to Collision Groups - Studio

here is the 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:SetPartCollisionGroup(object, "Mob")

				end
			end
			
			coroutine.wrap(mob.Move)(newMob, map)
		end
		

	else
		warn("Mob could not be found!", name)
	end
end

return mob

thanks for any help :wink:

1 Like

delete the first line : local PhysicsService
delete line: PhysicsService:SetPartCollisionGroup(object, “Mob”) and put this:

object.CollisionGroup = “Mobs”

they changed physicsservice, it’s not an error it still works fine it’s just a depreciation error like Enum.RaycastFilterType.Blacklist, it wont change anything

it does because the mobs dont spawn

they don’t spawn because you don’t set the position of the newmob and its position is probably set some random place

they dont spawn at the position i set…

what’s the script you’re using to spawn the mobs with

see this is the function I use to spawn enemies

function Wave:Spawn()
	local WaveData = self.Waves[self.Wave];
	local Enemies = WaveData.enemies;
	if(not Enemies) then
		warn("! Wave " .. self.Wave .. " skipped due to improper formatting. The wave in question: ",  self.Waves[self.Wave]);
		return;
	end
	local Map = workspace:WaitForChild("Map")
	local Tag = script:WaitForChild("EnemyTag", 2)
	if not Tag then
		warn("Could not find enemytag. Forcing continuation.")
		return;
	end
	local Waypoints,Path,Settings,Exit,Start = table.unpack(require(Map:FindFirstChildOfClass("ModuleScript")))
	
	local spawning = false;
	
	task.spawn(function()
		local cTime = os.time();
		spawning = true;
		for i,v in pairs(Enemies) do
			print(v, Enemies, WaveData);
			if cTime + v.SpawnDelay >= os.time() then
				for i=1,v.Amount do
					task.spawn(function()
						local Enemy = ServerStorage.Enemies:FindFirstChild(v.EnemyId)
						if Enemy then
							Enemy = Enemy:Clone()
							for a,b in pairs(Enemy.Head:GetChildren()) do
								if b.Name == "HeadWeld" then
									b:Destroy();
								end
							end
							local nTag = Tag:Clone()
							nTag.Parent = Enemy
							nTag.Adornee = Enemy.Head
							local rotCFrame = CFrame.lookAt(Start.Position,(Waypoints[1] or Exit).Position)
							Enemy.Parent = workspace.EnemyContainer
							Enemy.HumanoidRootPart.CFrame = rotCFrame			
							coroutine.wrap(function()
								EnemyManager:CreateEnemy(Enemy);
							end)()
						else
							warn("Enemy " .. v .. " could not be found.")
						end
					end)
					task.wait(v.DelaySpawning or 1);
				end
			end

		end
		spawning = false;
	end)
	while task.wait() do
		if ((#workspace.EnemyContainer:GetChildren() == 0 and not spawning) or SkipWave.Value == true) then
			break;
		end
	end
	SkipWave.Value = false;
	self.WaveTimer:Stop()
	self:AdvanceWave()
end

you see how I set the CFrame of the enemy’s humanoidrootpart

replace line 29 with

object.CollisionGroup = "Mob"

i got the mobs to spawn but the effort is to make the mobs not collide with the other mobs, heres what my table looks like
image

i did that and it worked for me

just need the mobs to not collide with eachother

PhysicsService:CollisionGroupSetCollidable("Mob","Mob",false)

that’s easy! just do

PhysicsService:CollisionGroupSetCollidable("Mob", "Mob", false)

also check this out

on what line
???

It just needs to be in the beginning line of a serverscript

in line 3 okokokokok ok
in line 3 ok

they still colide with eachother

oh, before line 3, add a new line then put PhysicsService:RegisterCollisionGroup("Mob") cuz without it the collision group Mob still dont exist