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:

PS:SetPartCollisionGroup(v,“A”)

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 = Instance.new("BallSocketConstraint",v.Parent)
			local a0,a1 = Instance.new("Attachment"),Instance.new("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
				PS:SetPartCollisionGroup(v,"B")
			elseif v.Name=="Head"then
				v.CanCollide = true
			end
		end
	end
end

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.
https://create.roblox.com/docs/reference/engine/classes/PhysicsService