Collision Groups not working

I have this script which tampers with the collision groups of an enemy when it gets added into the workspace. But for some odd reason, I can still collide with their HumanoidRootPart. This is what I do.

			for i, object in ipairs(newMob:GetDescendants()) do
				if object:IsA("BasePart") then
					object.CollisionGroup = "Enemy"
				end
			end

The function that it’s inside is working, I can see the collision groups changing with the enemy, and I know that it is the HumanoidRootPart because when I get rid of it, I can walk completely through.

Are you sure both players and the enemies have all their parts set to the Enemy collisiongroup and that the collision group is set to not collide with each others

or of course players can have own collision group if you set them to not collide

yep, players are getting added into a seperate group, iirc.

so you checked that players characters have all parts set to a collision group, and same for the enemy?

I’m pretty sure, but this is my script right now, just see if anything’s wrong.

local plrs = game:GetService("Players")

plrs.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		for i, object in ipairs(char:GetDescendants()) do
			if object:IsA("BasePart") then
				object.CollisionGroup = "Player"
				object.CanQuery = false
			end
		end

	end)
end)

when I try printing, it prints 16 times.

alright the scripts seem fine but can i see the collisiongroups gui where you can view all the groups and their collisions

Screenshot 2024-01-08 112427

all of them can only collide with default.
could it be because my character uses r15 and a default bacon, and they’re meshparts, because its never happened to me using a different avatar?

Edit: even though it says its being assigned, they’re not. Only the HumanoidRootPart is being assigned.

They seem right then, so for last thing i can think of is adding this little wait after your character spawns, maybe try that

1 Like

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