Collision Group doesn't work

I added the CollisionGroups like this!
image
image
image

local Players = game:GetService("Players")
local PhysicsService = game:GetService("PhysicsService")

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		for i, object in ipairs(character:GetDescendants()) do
			if object:IsA("BasePart") then
				object.CollisionGroup = "Player"
			end
		end
	end)
end)
local ServerStorage = game:GetService("ServerStorage")
local mob = {}
local PhysicsService = game:GetService("PhysicsService")

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
					object.CollisionGroup = "Mob"
				end
			end
			
			coroutine.wrap(mob.Move)(newMob, map)
		end
	else
		warn("Requested mob does not exist:",name)
	end
end

return mob

But the Player can still collide with the Mob and the Mob can still collide with the Player and the Mob can still collide with another Mob. Why?

In your game settings, is the avatar set too R6 or R15.
For R15, Player body parts are “MeshParts” so I dont think

if object:IsA("BasePart") then
				object.CollisionGroup = "Player"
			end

Would set every bodyPart to that collisionGroup

1 Like

The “BasePart” type includes any part type, including MeshParts.

Yeah I was just thinking that too!

Oh,sorry, my bad. Let me see if i can spot anyhting else

So I did litterally what you just said and made my character R6 and it works! But how to make it R15?

For your experience, you can set all the player’s avatar by going into Studio > Game > Game settings. There, go to Avatar and set player avatars to either R15 or R6, else if you are talking about personal avatars, you can go to your avatar editor and the option should be on your avatar preview image.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.