Collision group does not exist (Ragdoll Script)

i don’t know why its erroring if someone can explain to me and help me fix it please i appreciate a lot

error line:


local Module = {}

local RE = game.ReplicatedStorage.Ragdoll

local PS = game:GetService("PhysicsService")

Module.Joints = function(c)
	c.Humanoid.BreakJointsOnDeath = false
	c.Humanoid.RequiresNeck = false
	for _,v in pairs(c:GetDescendants()) do
		if v:IsA("Motor6D")and Module.Check(v.Name)then
			local b ="BallSocketConstraint",v.Parent)
			local a0,a1 ="Attachment"),"Attachment")
			a0.Parent,a1.Parent = v.Part0,v.Part1
			b.Attachment0,b.Attachment1 = a0,a1
			a0.CFrame,a1.CFrame = v.c0,v.c1
			b.LimitsEnabled = true
			b.TwistLimitsEnabled = true
			b.Enabled = false
		elseif v:IsA'BasePart' then
			PS:SetPartCollisionGroup(v,"A")  ------------ HERE IS THE ERROR
			if v.Name == "HumanoidRootPart" then
			elseif v.Name=="Head"then
				v.CanCollide = true

return Module


1 Like

Did you create a collision group in the first place?

PhysicsService:RegisterCollisionGroup("A")--Creates group A
PhysicsService:RegisterCollisionGroup("B")--Creates group B

PhysicsService:CollisionGroupSetCollidable("A", "B", false)--Makes so groups don't collide with eachother

I advise you make a seperate script for this so it does it only once on startup.

If you made the collision group in the editor and the names are correct then I think this should work.