Help with collision group

I am trying to work with collision group to make player not collide with other player and the mobs / also the mobs to be not collide with other mobs.
But the script that I’ve made and the collision group is not working

I can’t figure out what’s the error and their is no error in the output

ask for more detailed

here is the collision group
collision group

here is the part of the script for the mob collision group

			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("Part") then
					object.CollisionGroup = "Mob"
				end
			end

here is the script for the player collision group

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

Players.PlayerAdded:Connect(function(player)
	player.CharacterAppearanceLoaded:Connect(function(character)
		for i, object in ipairs(character:GetDescendants()) do
			if object:IsA("Part") then
				object.CollisionGroup = "Player"
			end
		end
	end)
end)

I made a quick glance over your code and all I think you have to do is change the check if object is a "Part" to "BasePart". For the Player, I suggest using this;

--//Variables
local Players = game:GetService("Players")
local PhysicsService = game:GetService("PhysicsService")

--//Code
Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		for i, object in ipairs(character:GetDescendants()) do
			if object:isA("BasePart") then --//looking for BasePart
				object.CollisionGroup = "Player"
			end
		end
	end)
end)

Then all you have to do for the mob collisiongroup is change the "Part" to "BasePart".

image

It looks like the player can actually collide with other players. Uncheck the box for “Player” in the Player collision group and see what happens.

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